Examples of UNIXUser


Examples of org.jvnet.libpam.UnixUser

     * @returns null if authentication failed,
     * returns the UnixUser object if authentication succeeded.
     *
     */
    private UnixUser authenticate(String username, String password) throws LoginException {
        UnixUser user = null;
        String pamService = null;

        if(_currentRealm instanceof PamRealm) {
            pamService = ((PamRealm)_currentRealm).getPamService();
        }
View Full Code Here

Examples of org.jvnet.libpam.UnixUser

            if ((name == null) || (password == null)) {
                debug("user or pass is null");
                return false;
            }
            debug("PAM authentication trying (" + serviceName + ") for: " + name);
            UnixUser authenticate = new PAM(serviceName).authenticate(name, new String(password));
            debug("PAM authentication succeeded for: " + name);
            this.unixUser = authenticate;

            return true;
        } catch (PAMException e) {
View Full Code Here

Examples of org.jvnet.libpam.UnixUser

        // A Unix user must have a name not null so check here.
        if ((_username == null) || (_username.length() == 0)) {
            throw new LoginException("Invalid Username");
        }
        UnixUser user = authenticate(_username, _password);

        if (user == null) {  // JAAS behavior
            throw new LoginException("Failed Pam Login for " + _username);
        }
        if (_logger.isLoggable(Level.FINE)) {
            _logger.log(Level.FINE, "PAM login succeeded for: " + _username);
        }
       
        /*
         * Get the groups from the libpam4j UnixUser class that has been
         * returned after a successful authentication.
         */

        String[] grpList = null;
        Set<String> groupSet = user.getGroups();
       
        if (groupSet != null) {
            grpList = new String[groupSet.size()];
            user.getGroups().toArray(grpList);
        }
        else {
            //Empty group list, create a zero-length group list
             grpList = new String[0];
        }
View Full Code Here

Examples of org.jvnet.libpam.UnixUser

     * @returns null if authentication failed,
     * returns the UnixUser object if authentication succeeded.
     *
     */
    private UnixUser authenticate(String username, String password) throws LoginException {
        UnixUser user = null;
        String pamService = null;

        if(_currentRealm instanceof PamRealm) {
            pamService = ((PamRealm)_currentRealm).getPamService();
        }
View Full Code Here

Examples of org.jvnet.libpam.UnixUser

        public Authentication authenticate(Authentication authentication) throws AuthenticationException {
            String username = authentication.getPrincipal().toString();
            String password = authentication.getCredentials().toString();

            try {
                UnixUser u = new PAM(serviceName).authenticate(username, password);
                Set<String> grps = u.getGroups();
                GrantedAuthority[] groups = new GrantedAuthority[grps.size()];
                int i=0;
                for (String g : grps)
                    groups[i++] = new GrantedAuthorityImpl(g);
                EnvVars.setHudsonUserEnvVar(username);
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.