Examples of UsernamePasswordCredential


Examples of org.uberfire.security.impl.auth.UsernamePasswordCredential

    @Override
    public Credential buildCredential( SecurityContext context ) {

        final UserPassSecurityContext basicSecurityContext = checkInstanceOf( "context", context, UserPassSecurityContext.class );

        return new UsernamePasswordCredential( basicSecurityContext.getUsername(), basicSecurityContext.getPassword() );
    }
View Full Code Here

Examples of org.uberfire.security.impl.auth.UsernamePasswordCredential

            final int index = auth.indexOf( ' ' );
            if ( index > 0 ) {
                final String[] credentials = new String( Base64.decodeBase64( auth.substring( index ) ), Charsets.UTF_8 ).split( ":" );

                if ( credentials.length == 2 ) {
                    return new UsernamePasswordCredential( credentials[ 0 ], credentials[ 1 ] );
                }
            }
        }

        return null;
View Full Code Here

Examples of org.uberfire.security.impl.auth.UsernamePasswordCredential

        if (userName == null || password == null) {
            return null;
        }

        return new UsernamePasswordCredential(userName, password);
    }
View Full Code Here

Examples of org.uberfire.security.impl.auth.UsernamePasswordCredential

    }

    @Override
    public boolean authenticate( final Credential credential,
                                 final SecurityContext securityContext ) {
        final UsernamePasswordCredential usernamePasswd = checkInstanceOf( "credential", credential, UsernamePasswordCredential.class );

        try {
            final LoginContext loginContext = new LoginContext( domain, new UsernamePasswordCallbackHandler( usernamePasswd ) );
            loginContext.login();
            subjects.set( loginContext.getSubject() );
View Full Code Here

Examples of org.uberfire.security.impl.auth.UsernamePasswordCredential

    }

    @Override
    public boolean authenticate( final Credential credential,
                                 final SecurityContext securityContext ) {
        final UsernamePasswordCredential usernamePasswd = checkInstanceOf( "credential", credential, UsernamePasswordCredential.class );

        final Object pass = credentials.get( usernamePasswd.getUserName() );
        if ( pass != null && pass.equals( usernamePasswd.getPassword() ) ) {
            return true;
        }
        return false;
    }
View Full Code Here

Examples of org.uberfire.security.impl.auth.UsernamePasswordCredential

    }

    @Override
    public boolean authenticate( final Credential credential,
                                 final SecurityContext securityContext ) {
        final UsernamePasswordCredential usernamePasswd = checkInstanceOf( "credential", credential, UsernamePasswordCredential.class );

        Connection connection = null;

        try {
            connection = getConnection();
            final PreparedStatement statement = connection.prepareStatement( userQuery );
            statement.setString( 1, usernamePasswd.getUserName() );
            statement.setObject( 2, usernamePasswd.getPassword() );
            final ResultSet queryResult = statement.executeQuery();
            final boolean result;
            if ( queryResult.next() ) {
                result = true;
            } else {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.