@SuppressWarnings("RedundantThrows") protected boolean authenticateInLdap(LoginPasswordCredentials credentials) throws LoginException { String login = credentials.getLogin(); String password = credentials.getPassword(); return ldapTemplate.authenticate(LdapUtils.emptyLdapName(), buildPersonFilter(login), password); }
authProvider.authenticate(loginPassword.getLogin(), loginPassword.getPassword(), loginPassword.getLocale());
protected AuthenticationDetails loginClient(LoginPasswordCredentials credentials) { String login = credentials.getLogin(); Locale credentialsLocale = credentials.getLocale() == null ? messages.getTools().getDefaultLocale() : credentials.getLocale(); if (Strings.isNullOrEmpty(login)) { // empty login is not valid throw new LoginException(getInvalidCredentialsMessage(login, credentialsLocale)); } UserSession systemSession = trustedClientService.getSystemSession(webAuthConfig.getTrustedClientPassword()); User user = AppContext.withSecurityContext(new SecurityContext(systemSession), () -> usersRepository.findUserByLogin(login)); if (user == null) { throw new LoginException(getInvalidCredentialsMessage(login, credentialsLocale)); } if (!passwordEncryption.checkPassword(user, credentials.getPassword())) { throw new LoginException(getInvalidCredentialsMessage(login, credentialsLocale)); } return authenticationService.login(createTrustedCredentials(credentials)); }
protected AuthenticationDetails loginClient(LoginPasswordCredentials credentials) { String login = credentials.getLogin(); Locale credentialsLocale = credentials.getLocale() == null ? messages.getTools().getDefaultLocale() : credentials.getLocale(); if (Strings.isNullOrEmpty(login)) { // empty login is not valid throw new LoginException(getInvalidCredentialsMessage(login, credentialsLocale)); } UserSession systemSession = trustedClientService.getSystemSession(restApiConfig.getTrustedClientPassword()); User user = AppContext.withSecurityContext(new SecurityContext(systemSession), () -> usersRepository.findUserByLogin(login)); if (user == null) { throw new LoginException(getInvalidCredentialsMessage(login, credentialsLocale)); } if (!passwordEncryption.checkPassword(user, credentials.getPassword())) { throw new LoginException(getInvalidCredentialsMessage(login, credentialsLocale)); } return authenticationService.login(createTrustedCredentials(credentials)); }
protected AuthenticationDetails loginClient(LoginPasswordCredentials credentials) { String login = credentials.getLogin(); Locale credentialsLocale = credentials.getLocale() == null ? messages.getTools().getDefaultLocale() : credentials.getLocale(); if (Strings.isNullOrEmpty(login)) { // empty login is not valid throw new LoginException(getInvalidCredentialsMessage(login, credentialsLocale)); } UserSession systemSession = trustedClientService.getSystemSession(portalConfig.getTrustedClientPassword()); User user = AppContext.withSecurityContext(new SecurityContext(systemSession), () -> usersRepository.findUserByLogin(login)); if (user == null) { throw new LoginException(getInvalidCredentialsMessage(login, credentialsLocale)); } if (!passwordEncryption.checkPassword(user, credentials.getPassword())) { throw new LoginException(getInvalidCredentialsMessage(login, credentialsLocale)); } return authenticationService.login(createTrustedCredentials(credentials)); }
@Override public AuthenticationDetails authenticate(Credentials credentials) throws LoginException { LoginPasswordCredentials loginAndPassword = (LoginPasswordCredentials) credentials; String login = loginAndPassword.getLogin(); Locale credentialsLocale = loginAndPassword.getLocale() == null ? messages.getTools().getDefaultLocale() : loginAndPassword.getLocale(); if (Strings.isNullOrEmpty(login)) { // empty login is not valid throw new LoginException(getInvalidCredentialsMessage(login, credentialsLocale)); } checkUserCredentials(credentials); User user = loadUser(login); if (user == null) { throw new LoginException(getInvalidCredentialsMessage(login, credentialsLocale)); } if (!passwordEncryption.checkPassword(user, loginAndPassword.getPassword())) { throw new LoginException(getInvalidCredentialsMessage(login, credentialsLocale)); } Locale userLocale = getUserLocale(loginAndPassword, user); UserSession session = createSession(loginAndPassword, user, userLocale); setClientSessionParams(loginAndPassword, session); AuthenticationDetails authenticationDetails = new SimpleAuthenticationDetails(session); checkUserAccess(loginAndPassword, authenticationDetails); return authenticationDetails; }