| | |
| | |
|
| | | /**
|
| | | * Implementation of a PAM user service for Linux/Unix/MacOSX.
|
| | | * |
| | | *
|
| | | * @author James Moger
|
| | | */
|
| | | public class PAMUserService extends GitblitUserService {
|
| | |
| | | private final Logger logger = LoggerFactory.getLogger(PAMUserService.class);
|
| | |
|
| | | private IStoredSettings settings;
|
| | | |
| | |
|
| | | public PAMUserService() {
|
| | | super();
|
| | | }
|
| | |
| | |
|
| | | serviceImpl = createUserService(realmFile);
|
| | | logger.info("PAM User Service backed by " + serviceImpl.toString());
|
| | | |
| | |
|
| | | // Try to identify the passwd database
|
| | | String [] files = { "/etc/shadow", "/etc/master.passwd" };
|
| | | File passwdFile = null;
|
| | |
| | | logger.error("PAM User Service can not read passwd database {}! PAM authentications may fail!", passwdFile);
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public boolean supportsCredentialChanges() {
|
| | | return false;
|
| | |
| | | public boolean supportsTeamMembershipChanges() {
|
| | | return true;
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | protected AccountType getAccountType() {
|
| | | return AccountType.PAM;
|
| | |
| | | // local account, bypass PAM authentication
|
| | | return super.authenticate(username, password);
|
| | | }
|
| | | |
| | |
|
| | | if (CLibrary.libc.getpwnam(username) == null) {
|
| | | logger.warn("Can not get PAM passwd for " + username);
|
| | | return null;
|
| | |
| | |
|
| | | // push the changes to the backing user service
|
| | | super.updateUserModel(user);
|
| | | |
| | |
|
| | | return user;
|
| | | }
|
| | | }
|