blob: 3059f9e81db60d015d8e909cfbd9db24c96f1ee7 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
package org.openslx.dozmod.authentication;
import org.apache.log4j.Logger;
import org.apache.thrift.TException;
import org.openslx.bwlp.thrift.iface.SessionData;
import org.openslx.bwlp.thrift.iface.TAuthorizationException;
import org.openslx.dozmod.authentication.ShibbolethEcp.ReturnCode;
import org.openslx.dozmod.thrift.Session;
import org.openslx.thrifthelper.ThriftManager;
/**
* @author Jonathan Bauer
*
*/
public class TestAccountAuthenticator implements Authenticator {
/**
* Logger instance for this class
*/
private final static Logger LOGGER = Logger.getLogger(TestAccountAuthenticator.class);
@Override
public void login(String username, String password, AuthenticatorCallback callback)
throws TAuthorizationException, TException {
SessionData authResult = null;
authResult = ThriftManager.getMasterClient().authenticate(username, password);
// handle answer from server
if (authResult != null && authResult.authToken != null) {
LOGGER.info(authResult);
Session.fromSessionData(authResult);
callback.postLogin(ReturnCode.NO_ERROR, null);
} else {
// it should then show a corresponding error message!
callback.postLogin(ReturnCode.GENERIC_ERROR, null);
}
}
}
|