/** * Authenticate the user in the supplied request. * * @param request authentication request * * @return response containing the ldap entry of the user authenticated * * @throws LdapException if an LDAP error occurs */ public AuthenticationResponse authenticate(final AuthenticationRequest request) throws LdapException { return authenticate(resolveDn(request.getUser()), request); }
/** * Authenticate the user in the supplied request. * * @param request authentication request * * @return response containing the ldap entry of the user authenticated * * @throws LdapException if an LDAP error occurs */ public AuthenticationResponse authenticate(final AuthenticationRequest request) throws LdapException { return authenticate(resolveDn(request.getUser()), request); }
/** * Authenticate the user in the supplied request. * * @param request authentication request * * @return response containing the ldap entry of the user authenticated * * @throws LdapException if an LDAP error occurs */ public AuthenticationResponse authenticate(final AuthenticationRequest request) throws LdapException { return authenticate(resolveDn(request.getUser()), request); }
final AuthenticationResponse response = auth.authenticate(request); final LdapEntry entry = response.getLdapEntry(); if (response.getResult()) {
private AuthenticationResponse getLdapAuthenticationResponse(final UsernamePasswordCredential upc) throws PreventedException { try { LOGGER.debug("Attempting LDAP authentication for [{}]. Authenticator pre-configured attributes are [{}], " + "additional requested attributes for this authentication request are [{}]", upc, authenticator.getReturnAttributes(), authenticatedEntryAttributes); val request = new AuthenticationRequest(upc.getUsername(), new org.ldaptive.Credential(upc.getPassword()), authenticatedEntryAttributes); return authenticator.authenticate(request); } catch (final LdapException e) { LOGGER.trace(e.getMessage(), e); throw new PreventedException("Unexpected LDAP error", e); } }
@Override public AuthenticationResponse authenticate(final AuthenticationRequest request) throws LdapException { final long start = System.nanoTime(); final LdapAuthenticateEvent event = new LdapAuthenticateEvent(); event.setId(id.get()); event.setSuccessful(false); try { final AuthenticationResponse result = MonitoredAuthenticator.super.authenticate(request); event.setSuccessful(true); return result; } catch (Throwable t) { event.setError(t.getMessage()); throw t; } finally { event.setElapsedTimeNano(System.nanoTime() - start); SystemInstance.get().fireEvent(event); } }
@Override protected AuthenticationResponse authenticate(final String dn, final AuthenticationRequest request) throws LdapException { final long start = System.nanoTime(); final LdapAuthenticateEvent event = new LdapAuthenticateEvent(); event.setId(id.get()); event.setSuccessful(false); try { final AuthenticationResponse result = MonitoredAuthenticator.super.authenticate(dn, request); event.setSuccessful(true); return result; } catch (Throwable t) { event.setError(t.getMessage()); throw t; } finally { event.setElapsedTimeNano(System.nanoTime() - start); SystemInstance.get().fireEvent(event); } }
final AuthenticationResponse response = auth.authenticate(request); final LdapEntry entry = response.getLdapEntry(); if (response.getResult()) {
final AuthenticationResponse response = auth.authenticate(request); final LdapEntry entry = response.getLdapEntry(); if (response.getResult()) {
authRequest.setCredential(new Credential(passCb.getPassword())); AuthenticationResponse response = auth.authenticate(authRequest); LdapEntry entry = null; if (response.getResult()) { if (tryFirstPass) { getCredentials(nameCb, passCb, true); response = auth.authenticate(authRequest); if (response.getResult()) { entry = response.getLdapEntry();
authRequest.setCredential(new Credential(passCb.getPassword())); AuthenticationResponse response = auth.authenticate(authRequest); LdapEntry entry = null; if (response.getResult()) { if (tryFirstPass) { getCredentials(nameCb, passCb, true); response = auth.authenticate(authRequest); if (response.getResult()) { entry = response.getLdapEntry();
authRequest.setCredential(new Credential(passCb.getPassword())); AuthenticationResponse response = auth.authenticate(authRequest); LdapEntry entry = null; if (response.getResult()) { if (tryFirstPass) { getCredentials(nameCb, passCb, true); response = auth.authenticate(authRequest); if (response.getResult()) { entry = response.getLdapEntry();
LOGGER.debug("Executing LDAP authentication request for user [{}]", username); val response = authenticator.authenticate(request); LOGGER.debug("LDAP response: [{}]", response);
@Override public void validate(final UsernamePasswordCredentials credentials, final WebContext context) { init(); final String username = credentials.getUsername(); CommonHelper.assertNotBlank(Pac4jConstants.USERNAME, username); final AuthenticationResponse response; try { logger.debug("Attempting LDAP authentication for: {}", credentials); final List<String> attributesToRead = defineAttributesToRead(); final AuthenticationRequest request = new AuthenticationRequest(username, new Credential(credentials.getPassword()), attributesToRead.toArray(new String[attributesToRead.size()])); response = this.ldapAuthenticator.authenticate(request); } catch (final LdapException e) { throw new TechnicalException("Unexpected LDAP error", e); } logger.debug("LDAP response: {}", response); if (response.getResult()) { final LdapEntry entry = response.getLdapEntry(); final List<Map<String, Object>> listAttributes = new ArrayList<>(); listAttributes.add(getAttributesFromEntry(entry)); final LdapProfile profile = convertAttributesToProfile(listAttributes, username); credentials.setUserProfile(profile); return; } if (AuthenticationResultCode.DN_RESOLUTION_FAILURE == response.getAuthenticationResultCode()) { throw new AccountNotFoundException(username + " not found"); } throw new BadCredentialsException("Invalid credentials for: " + username); }
AuthenticationResponse response = authenticator.authenticate( new AuthenticationRequest(username, new Credential(password), ReturnAttributes.ALL_USER.value())); if (response.getResult()) { // authentication succeeded
new org.ldaptive.Credential(password), this.authenticatedEntryAttributes); response = this.authenticator.authenticate(request); } catch (final LdapException e) { logger.trace(e.getMessage(), e);
new AuthenticationRequest(new User(getUsernamePasswordContext().getUsername(), context), new Credential(getUsernamePasswordContext().getPassword()), returnAttributes); response = authenticator.authenticate(request); log.trace("{} Authentication response {}", getLogPrefix(), response); if (response.getResult()) {