summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/openslx/imagemaster/serversession/ServerAuthenticator.java
diff options
context:
space:
mode:
authorNils Schwabe2014-08-26 16:14:45 +0200
committerNils Schwabe2014-08-26 16:14:45 +0200
commiteb1e6092732dee7e1751d6c756c448a7ba7b8c2c (patch)
tree8fc6462d45b869f1976bbcf610c8c4b1f474afaf /src/main/java/org/openslx/imagemaster/serversession/ServerAuthenticator.java
parentChange TThreadPoolServer to THsHaServer and use TNonBlockingServerTransport (diff)
downloadmasterserver-eb1e6092732dee7e1751d6c756c448a7ba7b8c2c.tar.gz
masterserver-eb1e6092732dee7e1751d6c756c448a7ba7b8c2c.tar.xz
masterserver-eb1e6092732dee7e1751d6c756c448a7ba7b8c2c.zip
Fix bug where the challengeResponse was to long
Fix some path bugs
Diffstat (limited to 'src/main/java/org/openslx/imagemaster/serversession/ServerAuthenticator.java')
-rw-r--r--src/main/java/org/openslx/imagemaster/serversession/ServerAuthenticator.java11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/main/java/org/openslx/imagemaster/serversession/ServerAuthenticator.java b/src/main/java/org/openslx/imagemaster/serversession/ServerAuthenticator.java
index a5fef69..ccd813e 100644
--- a/src/main/java/org/openslx/imagemaster/serversession/ServerAuthenticator.java
+++ b/src/main/java/org/openslx/imagemaster/serversession/ServerAuthenticator.java
@@ -51,7 +51,8 @@ public class ServerAuthenticator
String address, ByteBuffer challengeResponse )
throws AuthenticationException, TException
{
- byte[] bytes = challengeResponse.array();
+ byte[] bytes = new byte[ 512 ];
+ challengeResponse.get( bytes );
boolean result = false;
@@ -59,18 +60,18 @@ public class ServerAuthenticator
try {
verifier = new AsymMessageVerifier( organization );
} catch ( Exception e ) {
- throw new ServerAuthenticationException(ServerAuthenticationError.INVALID_ORGANIZATION, "Organization not found.");
+ throw new ServerAuthenticationException( ServerAuthenticationError.INVALID_ORGANIZATION, "Organization not found." );
}
-
+
try {
result = verifier.verifyMessage( bytes, authenticatingServers.get( organization ).getBytes() );
} catch ( Exception e ) {
log.error( "Error while verifying message", e );
- throw new ServerAuthenticationException(ServerAuthenticationError.INVALID_KEY, "Could not verfiy key.");
+ throw new ServerAuthenticationException( ServerAuthenticationError.INVALID_KEY, "Could not verfiy key." );
}
if ( !result ) {
- throw new ServerAuthenticationException(ServerAuthenticationError.INVALID_KEY, "Could not verfiy key.");
+ throw new ServerAuthenticationException( ServerAuthenticationError.INVALID_KEY, "Could not verfiy key." );
}
log.info( "Server of organinzation '" + organization + " authenticated." );