Integrate Shiro.

This commit is contained in:
Me Car 2016-01-05 03:48:43 +09:00
parent d0ea7d9c37
commit 32b4675f13
5 changed files with 184 additions and 2 deletions

View file

@ -102,6 +102,17 @@ public class Session {
if (m.find()) {
return "User name '" + userName + "' includes not allowed characters: use a-z, A-Z and 0-9";
}
AuthorizedUser authorizedUser = AuthorizedUserRepository.instance.get(userName);
if (authorizedUser == null) {
// Do this in an explicit sign-up flow.
AuthorizedUserRepository.instance.add(userName, password);
} else {
if (!authorizedUser.doCredentialsMatch(userName, password)) {
return "Wrong username or password";
}
}
// TODO: Do an authentication with userName and password.
User user = UserManager.getInstance().createUser(userName, host);
boolean reconnect = false;