| | |
| | | * @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; |
| | | } |
| | | } |