/** * Returns the groups a user belongs to * @param username * @return Set of group names * @throws PAMException * @deprecated * Pointless and ugly convenience method. */ public Set<String> getGroupsOfUser(String username) throws PAMException { return new UnixUser(username).getGroups(); }
/** * Returns the groups a user belongs to * @param username * @return Set of group names * @throws PAMException * @deprecated * Pointless and ugly convenience method. */ public Set<String> getGroupsOfUser(String username) throws PAMException { return new UnixUser(username).getGroups(); }
/** * Returns the groups a user belongs to * @param username * @return Set of group names * @throws PAMException * @deprecated * Pointless and ugly convenience method. */ public Set<String> getGroupsOfUser(String username) throws PAMException { return new UnixUser(username).getGroups(); }
/** * Authenticate the user with a password. * * @return * Upon a successful authentication, return information about the user. * @throws PAMException * If the authentication fails. */ public UnixUser authenticate(String username, String password) throws PAMException { this.password = password; try { check(libpam.pam_set_item(pht,PAM_USER,username),"pam_set_item failed"); check(libpam.pam_authenticate(pht,0),"pam_authenticate failed"); // several different error code seem to be used to represent authentication failures // check(libpam.pam_acct_mgmt(pht,0),"pam_acct_mgmt failed"); PointerByReference r = new PointerByReference(); check(libpam.pam_get_item(pht,PAM_USER,r),"pam_get_item failed"); String userName = r.getValue().getString(0); passwd pwd = libc.getpwnam(userName); if(pwd==null) throw new PAMException("Authentication succeeded but no user information is available"); return new UnixUser(userName,pwd); } finally { this.password = null; } }
/** * Authenticate the user with a password. * * @return * Upon a successful authentication, return information about the user. * @throws PAMException * If the authentication fails. */ public UnixUser authenticate(String username, String password) throws PAMException { this.password = password; try { check(libpam.pam_set_item(pht,PAM_USER,username),"pam_set_item failed"); check(libpam.pam_authenticate(pht,0),"pam_authenticate failed"); check(libpam.pam_setcred(pht,0),"pam_setcred failed"); // several different error code seem to be used to represent authentication failures // check(libpam.pam_acct_mgmt(pht,0),"pam_acct_mgmt failed"); PointerByReference r = new PointerByReference(); check(libpam.pam_get_item(pht,PAM_USER,r),"pam_get_item failed"); String userName = r.getValue().getString(0); Passwd pwd = libc.getpwnam(userName); if(pwd==null) throw new PAMException("Authentication succeeded but no user information is available"); return new UnixUser(userName,pwd); } finally { this.password = null; } }
/** * Authenticate the user with a password. * * @return * Upon a successful authentication, return information about the user. * @throws PAMException * If the authentication fails. */ public UnixUser authenticate(String username, String password) throws PAMException { this.password = password; try { check(libpam.pam_set_item(pht,PAM_USER,username),"pam_set_item failed"); check(libpam.pam_authenticate(pht,0),"pam_authenticate failed"); check(libpam.pam_setcred(pht,0),"pam_setcred failed"); // several different error code seem to be used to represent authentication failures check(libpam.pam_acct_mgmt(pht,0),"pam_acct_mgmt failed"); PointerByReference r = new PointerByReference(); check(libpam.pam_get_item(pht,PAM_USER,r),"pam_get_item failed"); String userName = r.getValue().getString(0); passwd pwd = libc.getpwnam(userName); if(pwd==null) throw new PAMException("Authentication succeeded but no user information is available"); return new UnixUser(userName,pwd); } finally { this.password = null; } }