Package org.jvnet.libpam

Examples of org.jvnet.libpam.PAM


    }

    @Override
    protected synchronized UserDetails authenticate(String username, String password) throws AuthenticationException {
        try {
            UnixUser uu = new PAM(serviceName).authenticate(username, password);

            // I never understood why Acegi insists on keeping the password...
            return new User(username,"",true,true,true,true, toAuthorities(uu));
        } catch (PAMException e) {
            throw new BadCredentialsException(e.getMessage(),e);
View Full Code Here


        info(Result.failure, "args[1]==null");
      }
      else {
        String userid = args[0];
        String password = args[1];
        UnixUser u = new PAM("sshd").authenticate(userid, password);
        info(Result.success, "groups = "+u.getGroups().toString());
      }
     
    }
    catch(Throwable t) {
View Full Code Here

    if (CLibrary.libc.getpwnam(username) == null) {
      logger.warn("Can not get PAM passwd for " + username);
      return null;
    }

    PAM pam = null;
    try {
      String serviceName = settings.getString(Keys.realm.pam.serviceName, "system-auth");
      pam = new PAM(serviceName);
      pam.authenticate(username, new String(password));
    } catch (PAMException e) {
      logger.error(e.getMessage());
      return null;
    } finally {
      if (pam != null) {
        pam.dispose();
      }
    }

        UserModel user = userManager.getUserModel(username);
        if (user == null) {
View Full Code Here

    }
   
    @Override
    public Enumeration getGroupNames(String username) throws NoSuchUserException {  
        try {
            Set<String> groupsSet = new PAM(PAM_SERVICE).getGroupsOfUser(username);
            return Collections.enumeration(groupsSet);
        } catch (PAMException ex) {
            Logger.getLogger(PamRealm.class.getName()).log(Level.SEVERE,
                    "pam_exception_getgroupsofuser", ex);
            return null;
View Full Code Here

        else {
            throw new LoginException("pamrealm.invalid_realm");
        }
      
        try {
            user = new PAM(pamService).authenticate(username, password);

        } catch (PAMException e) {
              _logger.log(Level.SEVERE, "pam_exception_authenticate", e);
        }
        return user;
View Full Code Here

        else {
            throw new LoginException("pamrealm.invalid_realm");
        }
      
        try {
            user = new PAM(pamService).authenticate(username, password);

        } catch (PAMException e) {
              _logger.log(Level.SEVERE, "pam_exception_authenticate", e);
        }
        return user;
View Full Code Here

    }
   
    @Override
    public Enumeration getGroupNames(String username) throws NoSuchUserException {  
        try {
            Set<String> groupsSet = new PAM(PAM_SERVICE).getGroupsOfUser(username);
            return Collections.enumeration(groupsSet);
        } catch (PAMException ex) {
            Logger.getLogger(PamRealm.class.getName()).log(Level.SEVERE,
                    "pam_exception_getgroupsofuser", ex);
            return null;
View Full Code Here

    }
   
    @Override
    public Enumeration getGroupNames(String username) throws NoSuchUserException {  
        try {
            Set<String> groupsSet = new PAM(PAM_SERVICE).getGroupsOfUser(username);
            return Collections.enumeration(groupsSet);
        } catch (PAMException ex) {
            Logger.getLogger(PamRealm.class.getName()).log(Level.SEVERE,
                    "pam_exception_getgroupsofuser", ex);
            return null;
View Full Code Here

        else {
            throw new LoginException("pamrealm.invalid_realm");
        }
      
        try {
            user = new PAM(pamService).authenticate(username, password);

        } catch (PAMException e) {
              _logger.log(Level.SEVERE, "pam_exception_authenticate", e);
        }
        return user;
View Full Code Here

            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

TOP

Related Classes of org.jvnet.libpam.PAM

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.