Пример #1
0
 public AuthenticationToken Authenticate(String u, String pass) {
   if (sessions.containsKey(u)) {
     AuthenticationToken token = new AuthenticationToken(this);
     token.setAuthenticationType(AuthenticationTokenType.ALREADY_LOGGED_IN);
     return token; // bad token, already logged in
   }
   if (authenticator.Authenticate(u, pass)) {
     AuthenticationToken token = new AuthenticationToken(this, u);
     token.login();
     sessions.put(u, token);
     return token;
   } else {
     AuthenticationToken token = new AuthenticationToken(this);
     token.setAuthenticationType(AuthenticationTokenType.LOGIN_FAILED);
     return token; // bad auth
   }
 }
Пример #2
0
 @Override
 public void onLoadSettings(Map settings) {
   super.onLoadSettings(settings);
   if (settings == null) return;
   ua.loadFromStorage(settings);
 }