Java 8 AccountNotFoundException - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 AccountNotFoundException class.

This code example shows how to use the following methods:
 
        char[] pwd = lookupPassword(principal);
         
        if (pwd == null)
        { 
            throw new AccountNotFoundException("Unable to lookup the specified users password");
        } 
 
        return compareCharArray(pwd, password);
 
    } 
 
    protected PlainUser createUserFromPassword(Principal principal, char[] passwd)
    { 
        return new PlainUser(principal.getName(), passwd);
    } 
 
 
    @Override 
    protected PlainUser createUserFromFileData(String[] result)
4
CodeRank
This code example shows how to use the following methods:
callback.setPassword(pwd);
        } 
        else 
        { 
            throw new AccountNotFoundException("No account found for principal " + principal);
        } 
    } 
 
 
    /** 
     * Looks up the password for a specified user in the password file. Note this code is <b>not</b> secure since it 
     * creates strings of passwords. It should be modified to create only char arrays which get nulled out. 
     * 
     * @param name The principal name to lookup 
     * 
     * @return a char[] for use in SASL. 
     */ 
    protected final char[] lookupPassword(String name)
    { 
4
CodeRank
This code example shows how to use the following methods:
        final String username = credential.getUsername();
        final String cachedPassword = this.users.get(username);
 
        if (cachedPassword == null) {
           logger.debug("{} was not found in the map.", username);
           throw new AccountNotFoundException(username + " not found in backing map.");
        } 
 
        final String encodedPassword = this.getPasswordEncoder().encode(credential.getPassword());
        if (!cachedPassword.equals(encodedPassword)) {
            throw new FailedLoginException();
        } 
        return createHandlerResult(credential, new SimplePrincipal(username), null);
    } 
 
    /** 
     * @param users The users to set. 
     */ 
    public final void setUsers(final Map<String, String> users) {
        this.users = Collections.unmodifiableMap(users);
3
CodeRank
This code example shows how to use the following methods:
    @Override 
    protected final HandlerResult doAuthentication(final Credential credential)
            throws GeneralSecurityException, PreventedException {
        final UsernamePasswordCredential userPass = (UsernamePasswordCredential) credential;
        if (userPass.getUsername() == null) {
            throw new AccountNotFoundException("Username is null.");
        } 
         
        final String transformedUsername= this.principalNameTransformer.transform(userPass.getUsername());
        if (transformedUsername == null) {
            throw new AccountNotFoundException("Transformed username is null.");
        } 
        userPass.setUsername(transformedUsername);
        return authenticateUsernamePasswordInternal(userPass);
    } 
 
    /** 
     * Authenticates a username/password credential by an arbitrary strategy. 
     * 
     * @param transformedCredential the credential object bearing the transformed username and password. 
3
CodeRank
See Code Examples for Java 8 AccountNotFoundException Methods: