Package org.uberfire.security.server.auth.impl

Source Code of org.uberfire.security.server.auth.impl.JAASAuthenticationManager

package org.uberfire.security.server.auth.impl;

import java.util.HashMap;
import javax.enterprise.inject.Alternative;

import org.uberfire.security.auth.RolesMode;
import org.uberfire.security.auth.SubjectPropertiesProvider;
import org.uberfire.security.server.auth.BasicUserPassAuthenticationScheme;
import org.uberfire.security.server.auth.source.JAASAuthenticationSource;

import static org.uberfire.security.server.SecurityConstants.*;

@Alternative
public class JAASAuthenticationManager extends SimpleUserPassAuthenticationManager {

    public JAASAuthenticationManager() {
        this( null );
    }

    public JAASAuthenticationManager( final String realm ) {
        this( null, realm, null );
    }

    public JAASAuthenticationManager( final String realm,
                                      final RolesMode mode ) {
        this( null, realm, mode );
    }

    public JAASAuthenticationManager( final SubjectPropertiesProvider propertiesProvider,
                                      final String realm,
                                      final RolesMode mode ) {
        super( new JAASAuthenticationSource(),
               new BasicUserPassAuthenticationScheme(),
               null,
               propertiesProvider,
               new HashMap<String, String>() {{
                   if ( realm != null ) {
                       put( AUTH_DOMAIN_KEY, realm );
                   }
                   if ( mode != null ) {
                       put( ROLE_MODE_KEY, mode.toString() );
                   }
               }} );
    }

}
TOP

Related Classes of org.uberfire.security.server.auth.impl.JAASAuthenticationManager

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.