Package org.uberfire.security.auth

Examples of org.uberfire.security.auth.AuthenticationResult


    @Override
    public AuthenticationResult authenticate( final Credential credential, final SecurityContext securityContext )
            throws AuthenticationException {
        if ( !supportsCredential( credential ) ) {
            return new AuthenticationResult() {
                @Override
                public List<String> getMessages() {
                    return new ArrayList<String>( 1 ) {{
                        add( "Credential not supported by " + DefaultAuthenticationProvider.class.getName() );
                    }};
                }

                @Override
                public AuthenticationStatus getStatus() {
                    return AuthenticationStatus.NONE;
                }

                @Override
                public Principal getPrincipal() {
                    return null;
                }
            };
        }

        final UserNameCredential realCredential = UserNameCredential.class.cast( credential );

        if ( !authenticationSource.authenticate( realCredential, securityContext ) ) {
            return new AuthenticationResult() {
                @Override
                public List<String> getMessages() {
                    return new ArrayList<String>( 1 ) {{
                        add( "Invalid credentials." );
                    }};
                }

                @Override
                public AuthenticationStatus getStatus() {
                    return AuthenticationStatus.FAILED;
                }

                @Override
                public Principal getPrincipal() {
                    return null;
                }
            };
        }

        return new AuthenticationResult() {
            @Override
            public List<String> getMessages() {
                return emptyList();
            }
View Full Code Here


    @Override
    public AuthenticationResult authenticate( final Credential credential, final SecurityContext securityContext ) throws AuthenticationException {

        if ( !supportsCredential( credential ) ) {
            return new AuthenticationResult() {
                @Override
                public List<String> getMessages() {
                    return new ArrayList<String>( 1 ) {{
                        add( "Credential not supported by " + RememberMeCookieAuthProvider.class.getName() );
                    }};
                }

                @Override
                public AuthenticationStatus getStatus() {
                    return AuthenticationStatus.NONE;
                }

                @Override
                public Principal getPrincipal() {
                    return null;
                }
            };
        }

        final RememberMeCookieAuthScheme.RememberMeCredential realCredential = RememberMeCookieAuthScheme.RememberMeCredential.class.cast( credential );

        return new AuthenticationResult() {
            @Override
            public List<String> getMessages() {
                return emptyList();
            }
View Full Code Here

                if ( credential == null ) {
                    continue;
                }

                for ( final AuthenticationProvider authProvider : authProviders ) {
                    final AuthenticationResult result = authProvider.authenticate( credential, context );
                    if ( result.getStatus().equals( FAILED ) ) {
                        authScheme.challengeClient( httpContext );
                        throw new AuthenticationException( "Invalid credentials." );
                    } else if ( result.getStatus().equals( SUCCESS ) ) {
                        principal = result.getPrincipal();
                        break all_auth;
                    }
                }
            }
        }
View Full Code Here

        if ( credential == null ) {
            throw new AuthenticationException( "Invalid credentials." );
        }

        final AuthenticationResult authResult = authProvider.authenticate( credential, context );

        if ( authResult.getStatus().equals( SUCCESS ) ) {
            principal = authResult.getPrincipal();
        } else {
            principal = null;
        }

        if ( principal == null ) {
View Full Code Here

TOP

Related Classes of org.uberfire.security.auth.AuthenticationResult

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.