diff options
author | Nils Schwabe | 2014-04-23 15:10:36 +0200 |
---|---|---|
committer | Nils Schwabe | 2014-04-23 15:10:36 +0200 |
commit | f71e8a5bcd2d7f85f58fedf3f6ea8dc8c7f89b63 (patch) | |
tree | 5a79e7f320e6ca76ade3cf8039079d182f0178ad /src/main/java/org/openslx/imagemaster/serversession/ServerAuthenticator.java | |
parent | Fix some issues with FtpCredentialsScheduler (diff) | |
download | masterserver-f71e8a5bcd2d7f85f58fedf3f6ea8dc8c7f89b63.tar.gz masterserver-f71e8a5bcd2d7f85f58fedf3f6ea8dc8c7f89b63.tar.xz masterserver-f71e8a5bcd2d7f85f58fedf3f6ea8dc8c7f89b63.zip |
Reformat all files with simon's new layout
Diffstat (limited to 'src/main/java/org/openslx/imagemaster/serversession/ServerAuthenticator.java')
-rw-r--r-- | src/main/java/org/openslx/imagemaster/serversession/ServerAuthenticator.java | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/src/main/java/org/openslx/imagemaster/serversession/ServerAuthenticator.java b/src/main/java/org/openslx/imagemaster/serversession/ServerAuthenticator.java index d57eb36..726b062 100644 --- a/src/main/java/org/openslx/imagemaster/serversession/ServerAuthenticator.java +++ b/src/main/java/org/openslx/imagemaster/serversession/ServerAuthenticator.java @@ -7,8 +7,9 @@ import org.apache.thrift.TException; import org.openslx.imagemaster.thrift.iface.AuthenticationException; import org.openslx.imagemaster.util.RandomString; -public class ServerAuthenticator { - private static Logger log = Logger.getLogger(ServerAuthenticator.class); +public class ServerAuthenticator +{ + private static Logger log = Logger.getLogger( ServerAuthenticator.class ); // map of currently authenticating servers private static HashMap<String, String> authenticatingServers = new HashMap<String, String>(); @@ -16,16 +17,17 @@ public class ServerAuthenticator { * Start the server authentification. * * @param organization - * the organization of the server + * the organization of the server * @return encrypted random string */ - public static String startServerAuthentication(String organization) { - String secret = RandomString.generate(100, false); - synchronized (authenticatingServers) { - authenticatingServers.put(organization, secret); - log.info("Server of organinzation '" + organization + public static String startServerAuthentication( String organization ) + { + String secret = RandomString.generate( 100, false ); + synchronized ( authenticatingServers ) { + authenticatingServers.put( organization, secret ); + log.info( "Server of organinzation '" + organization + "' starts to authenticate. And got string: '" + secret - + "'"); + + "'" ); } return secret; } @@ -40,23 +42,24 @@ public class ServerAuthenticator { * @throws AuthenticationException * @throws TException */ - public static ServerUser serverAuthenticate(String organization, - String address, String challengeResponse) - throws AuthenticationException, TException { + public static ServerUser serverAuthenticate( String organization, + String address, String challengeResponse ) + throws AuthenticationException, TException + { /* * TODO: Decrypt the given challengeResponse and check whether it was * right or not. Authenticate server if so. */ - if (!challengeResponse.equals(authenticatingServers.get(organization))) { + if ( !challengeResponse.equals( authenticatingServers.get( organization ) ) ) { throw new AuthenticationException(); } - - log.info("Server of organinzation '" + organization + + log.info( "Server of organinzation '" + organization + " authenticated. With response: '" + challengeResponse - + "'"); + + "'" ); - authenticatingServers.remove(organization); + authenticatingServers.remove( organization ); - return new ServerUser(organization, address); + return new ServerUser( organization, address ); } } |