Code example for PasswordAuthentication

Methods: getPassword, getUserName

0
    } 
 
 
    String createAuthenticationHeader() {
        PasswordAuthentication credentials = getCredentialsForRealm();
        return getAuthenticationStrategy().createAuthenticationHeader( this, credentials.getUserName(), new String( credentials.getPassword() ) );
    } 
 
 
    private AuthenticationStrategy getAuthenticationStrategy() { 
        if (getAuthenticationType().equalsIgnoreCase( "basic" ) ) return BASIC_AUTHENTICATION;
        if (getAuthenticationType().equalsIgnoreCase( "digest" ) ) return DIGEST_AUTHENTICATION;
        throw new RuntimeException( "Unsupported authentication type '" + getAuthenticationType() + "'" );
    } 
 
 
    private AuthorizationRequiredException createAuthorizationRequiredException() { 
        return AuthorizationRequiredException.createException( getAuthenticationType(), getProperties() ); 
    }