From 0ed5db9366541069ac4585c16d57138a9c4deac2 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Wed, 1 Oct 2014 16:53:55 +0200 Subject: Adapt to changed DB scheme (eppn handling for multiple suffixes) --- .../org/openslx/imagemaster/server/ApiServer.java | 39 ++++++++++++++++------ 1 file changed, 29 insertions(+), 10 deletions(-) (limited to 'src/main/java/org/openslx/imagemaster/server/ApiServer.java') diff --git a/src/main/java/org/openslx/imagemaster/server/ApiServer.java b/src/main/java/org/openslx/imagemaster/server/ApiServer.java index b39a517..6c5413f 100644 --- a/src/main/java/org/openslx/imagemaster/server/ApiServer.java +++ b/src/main/java/org/openslx/imagemaster/server/ApiServer.java @@ -24,6 +24,7 @@ import org.openslx.imagemaster.thrift.iface.ImageData; import org.openslx.imagemaster.thrift.iface.ImageDataError; import org.openslx.imagemaster.thrift.iface.ImageDataException; import org.openslx.imagemaster.thrift.iface.InvalidTokenException; +import org.openslx.imagemaster.thrift.iface.OrganizationData; import org.openslx.imagemaster.thrift.iface.ServerAuthenticationError; import org.openslx.imagemaster.thrift.iface.ServerAuthenticationException; import org.openslx.imagemaster.thrift.iface.ServerSessionData; @@ -81,8 +82,8 @@ public class ApiServer final Session session = SessionManager.getSession( token ); if ( session == null ) throw new InvalidTokenException(); - return new UserInfo( session.getUserId(), session.getFirstName(), - session.getLastName(), session.getEMail() ); + return new UserInfo( session.getLogin(), session.getFirstName(), + session.getLastName(), session.getEMail(), session.getOrgenizationId() ); } public static UploadData submitImage( String serverSessionId, ImageData imageDescription, List crcSums ) @@ -119,18 +120,18 @@ public class ApiServer * key of the requesting satellite server * @throws ServerAuthenticationException when organization is invalid/unknown */ - public static ByteBuffer startServerAuthentication( String organization ) + public static ByteBuffer startServerAuthentication( String organizationId ) throws ServerAuthenticationException { - if ( organization == null || organization.isEmpty() ) + if ( organizationId == null || organizationId.isEmpty() ) throw new ServerAuthenticationException( ServerAuthenticationError.INVALID_ORGANIZATION, "Empty organization" ); - DbSatellite satellite = DbSatellite.fromOrganization( organization ); + DbSatellite satellite = DbSatellite.fromOrganizationId( organizationId ); if ( satellite == null ) - throw new ServerAuthenticationException( ServerAuthenticationError.INVALID_ORGANIZATION, "Unknown organization: '" + organization + "'" ); + throw new ServerAuthenticationException( ServerAuthenticationError.INVALID_ORGANIZATION, "Unknown organization: '" + organizationId + "'" ); if ( satellite.getPubkey() == null ) throw new ServerAuthenticationException( ServerAuthenticationError.INVALID_KEY, "There is no public key known for your organization." ); - return ServerAuthenticator.startServerAuthentication( organization ); + return ServerAuthenticator.startServerAuthentication( organizationId ); } /** @@ -142,14 +143,14 @@ public class ApiServer * @throws AuthenticationException * @throws TException */ - public static ServerSessionData serverAuthenticate( String organization, + public static ServerSessionData serverAuthenticate( String organizationId, ByteBuffer challengeResponse ) throws ServerAuthenticationException, TException { - if ( organization == null || challengeResponse == null ) { + if ( organizationId == null || challengeResponse == null ) { throw new ServerAuthenticationException( ServerAuthenticationError.INVALID_ORGANIZATION, "Empty organization or challengeResponse" ); } - DbSatellite satellite = DbSatellite.fromOrganization( organization ); + DbSatellite satellite = DbSatellite.fromOrganizationId( organizationId ); if ( satellite == null ) throw new ServerAuthenticationException( ServerAuthenticationError.INVALID_ORGANIZATION, "Unknown organization" ); if ( satellite.getPubkey() == null ) @@ -165,4 +166,22 @@ public class ApiServer { return ( ServerSessionManager.getSession( serverSessionId ) != null ); } + + public static boolean publishUser( String serverSessionId, UserInfo user ) + { + // TODO Auto-generated method stub + return false; + } + + public static List findUser( String sessionId, String organizationId, String searchTerm ) + { + // TODO Auto-generated method stub + return null; + } + + public static List getOrganizations() + { + // TODO Auto-generated method stub + return null; + } } -- cgit v1.2.3-55-g7522