/** * password supplied authentication check * * @param webCredential * @return true if authenticated * @throws LoginException */ protected boolean credentialLogin(Object webCredential) throws LoginException { setAuthenticated(getCurrentUser().checkCredential(webCredential)); return isAuthenticated(); }
/** * @see javax.security.auth.spi.LoginModule#abort() * @throws LoginException */ public boolean abort() throws LoginException { this.currentUser = null; return (isAuthenticated() && isCommitted()); }
public String getUserName () { return this.user.getUserName(); }
/** * get the available information about the user * <p/> * for this LoginModule, the credential can be null which will result in a * binding ldap authentication scenario * <p/> * roles are also an optional concept if required * * @param username * @return the userinfo for the username * @throws Exception */ public UserInfo getUserInfo(String username) throws Exception { String pwdCredential = getUserCredentials(username); if (pwdCredential == null) { return null; } pwdCredential = convertCredentialLdapToJetty(pwdCredential); Credential credential = Credential.getCredential(pwdCredential); List<String> roles = getUserRoles(_rootContext, username); return new UserInfo(username, credential, roles); }
/** * @see javax.security.auth.spi.LoginModule#commit() * @return true if committed, false if not (likely not authenticated) * @throws LoginException */ public boolean commit() throws LoginException { if (!isAuthenticated()) { currentUser = null; setCommitted(false); return false; } setCommitted(true); currentUser.setJAASInfo(subject); return true; }
/** * Read contents of the configured property file. * * @see javax.security.auth.spi.LoginModule#initialize(javax.security.auth.Subject, javax.security.auth.callback.CallbackHandler, java.util.Map, * java.util.Map) * @param subject * @param callbackHandler * @param sharedState * @param options */ public void initialize(Subject subject, CallbackHandler callbackHandler, Map<String, ?> sharedState, Map<String, ?> options) { super.initialize(subject,callbackHandler,sharedState,options); setupPropertyUserStore(options); }
public boolean checkCredential (Object suppliedCredential) { return this.user.checkCredential(suppliedCredential); } }
/** * @see javax.security.auth.spi.LoginModule#logout() * @return true always * @throws LoginException */ public boolean logout() throws LoginException { this.currentUser.unsetJAASInfo(this.subject); return true; }
public JAASUserInfo (UserInfo u) { setUserInfo(u); }
/** * attempts to get the users roles from the root context * <p/> * NOTE: this is not an user authenticated operation * * @param dirContext * @param username * @return * @throws LoginException */ private List<String> getUserRoles(DirContext dirContext, String username) throws LoginException, NamingException { String userDn = _userRdnAttribute + "=" + username + "," + _userBaseDn; return getUserRolesByDn(dirContext, userDn); }
public void unsetJAASInfo (Subject subject) { subject.getPrincipals().remove(this.principal); subject.getPrivateCredentials().remove(this.user.getCredential()); subject.getPrincipals().removeAll(this.roles); }
/** * password supplied authentication check * * @param webCredential * @return true if authenticated * @throws LoginException */ protected boolean credentialLogin(Object webCredential) throws LoginException { setAuthenticated(getCurrentUser().checkCredential(webCredential)); return isAuthenticated(); }
/** * @see javax.security.auth.spi.LoginModule#commit() * @return true if committed, false if not (likely not authenticated) * @throws LoginException */ public boolean commit() throws LoginException { if (!isAuthenticated()) { currentUser = null; setCommitted(false); return false; } setCommitted(true); currentUser.setJAASInfo(subject); return true; }
/** * @see javax.security.auth.spi.LoginModule#abort() * @throws LoginException */ public boolean abort() throws LoginException { this.currentUser = null; return (isAuthenticated() && isCommitted()); }
/** * Read contents of the configured property file. * * @see javax.security.auth.spi.LoginModule#initialize(javax.security.auth.Subject, javax.security.auth.callback.CallbackHandler, java.util.Map, * java.util.Map) * @param subject * @param callbackHandler * @param sharedState * @param options */ public void initialize(Subject subject, CallbackHandler callbackHandler, Map<String, ?> sharedState, Map<String, ?> options) { super.initialize(subject,callbackHandler,sharedState,options); setupPropertyUserStore(options); }
public String getUserName () { return this.user.getUserName(); }
public boolean checkCredential (Object suppliedCredential) { return this.user.checkCredential(suppliedCredential); } }
/** * @see javax.security.auth.spi.LoginModule#logout() * @return true always * @throws LoginException */ public boolean logout() throws LoginException { this.currentUser.unsetJAASInfo(this.subject); return true; }
public JAASUserInfo (UserInfo u) { setUserInfo(u); }
/** * attempts to get the users roles from the root context * <p/> * NOTE: this is not an user authenticated operation * * @param dirContext * @param username * @return * @throws LoginException */ private List<String> getUserRoles(DirContext dirContext, String username) throws LoginException, NamingException { String userDn = _userRdnAttribute + "=" + username + "," + _userBaseDn; return getUserRolesByDn(dirContext, userDn); }