Log-Eintraege fuer log in
| | |
| | | * @param password das Kennwort des Benutzers |
| | | * @return Token oder null, wenn die Anmeldung misslang |
| | | */ |
| | | public LoginResponse login(String userId, String password) { |
| | | public LoginResponse login(HttpExchange e, String userId, String password) { |
| | | if (realm.isValid(userId, password)) { |
| | | logger.info(userId + " logged in from IP." + e.getRemoteAddress()); |
| | | LoginResponse r = new LoginResponse(); |
| | | String token = createToken(userId, expireSeconds); |
| | | r.setToken(token); |
| | |
| | | r.setExpiresIn(expireSeconds); |
| | | return r; |
| | | } else { |
| | | logger.info("Invalid log in attempt for " + userId + " from IP " + e.getRemoteAddress()); |
| | | return null; |
| | | } |
| | | } |
| | |
| | | if (o instanceof BearerAuthenticator) { |
| | | BearerAuthenticator auth = (BearerAuthenticator) o; |
| | | User user = getUser(exchange); |
| | | LoginResponse response = auth.login(user.getName(), user.getPassword()); |
| | | LoginResponse response = auth.login(exchange, user.getName(), user.getPassword()); |
| | | handleLoginResponse(exchange, response); |
| | | } else { |
| | | HttpResponder r = new HttpResponder(); |