summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/openslx/imagemaster/server/ApiServer.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/openslx/imagemaster/server/ApiServer.java')
-rw-r--r--src/main/java/org/openslx/imagemaster/server/ApiServer.java39
1 files changed, 29 insertions, 10 deletions
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<Integer> 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<UserInfo> findUser( String sessionId, String organizationId, String searchTerm )
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public static List<OrganizationData> getOrganizations()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
}