Examples of Pam


Examples of net.sf.jpam.Pam

    // Add generated JAAS Configuration
    CoreJAASConfiguration config = (CoreJAASConfiguration) Configuration.getConfiguration();
    config.addAppConfigurationEntry(PAMUserDatabase.class.getName(), entry);

    // Instantiate members with Property dependencies
    pam = new Pam(serviceName);

    // Add defaults groups
    addGroup("Users");
   
  }
View Full Code Here

Examples of net.sf.jpam.Pam

        this.service = service;
    }

    public boolean authenticate(String username, String password, ServerSession session) {
        LOG.info("Authenticating user {} using PAM", username);
        PamReturnValue val = new Pam(service).authenticate(username, password);
        LOG.info("Result: {}", val);
        if (PamReturnValue.PAM_SUCCESS.equals(val)) {
            return true;
        }
        return false;
View Full Code Here

Examples of net.sf.jpam.Pam

        this.service = service;
    }

    public Object authenticate(String username, String password) {
        LOG.info("Authenticating user {} using PAM", username);
        PamReturnValue val = new Pam(service).authenticate(username, password);
        LOG.info("Result: {}", val);
        if (PamReturnValue.PAM_SUCCESS.equals(val)) {
            return username;
        }
        return null;
View Full Code Here

Examples of net.sf.jpam.Pam

            UnsupportedCallbackException {
        for (int i = 0; i < callbacks.length; i++) {
            // When the server side need to authenticate the user
            WSPasswordCallback pwcb = (WSPasswordCallback) callbacks[i];
            if (pwcb.getUsage() == WSPasswordCallback.USERNAME_TOKEN_UNKNOWN) {
                Pam pam = new Pam();
                PamReturnValue ret = pam.authenticate(pwcb.getIdentifer(), pwcb
                        .getPassword());
                if (ret.equals(PamReturnValue.PAM_SUCCESS)) {
                    return;
                } else {
                    throw new IOException("check failed");
View Full Code Here

Examples of net.sf.jpam.Pam

        this.service = service;
    }

    public Object authenticate(String username, String password, ServerSession session) {
        LOG.info("Authenticating user {} using PAM", username);
        PamReturnValue val = new Pam(service).authenticate(username, password);
        LOG.info("Result: {}", val);
        if (PamReturnValue.PAM_SUCCESS.equals(val)) {
            return username;
        }
        return null;
View Full Code Here

Examples of net.sf.jpam.Pam

      throw new AuthenticationException("No PAM services are set.");
    }

    String[] pamServices = pamServiceNames.split(",");
    for (String pamService : pamServices) {
      Pam pam = new Pam(pamService);
      boolean isAuthenticated = pam.authenticateSuccessful(user, password);
      if (!isAuthenticated) {
        throw new AuthenticationException(
          "Error authenticating with the PAM service: " + pamService);
      }
    }
View Full Code Here

Examples of net.sf.jpam.Pam

      throw new AuthenticationException("No PAM services are set.");
    }

    String pamServices[] = pamServiceNames.split(",");
    for (String pamService : pamServices) {
      Pam pam = new Pam(pamService);
      boolean isAuthenticated = pam.authenticateSuccessful(user, password);
      if (!isAuthenticated) {
        throw new AuthenticationException("Error authenticating with the PAM service: " + pamService);
      }
    }
  }
View Full Code Here

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

Examples of org.jvnet.libpam.PAM

        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

Examples of org.jvnet.libpam.PAM

    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
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.