setCurrentUser(new JAASUserInfo(userInfo));
currentUser = new JAASUserInfo(userInfo); setAuthenticated(currentUser.checkCredential(webCredential));
setCurrentUser(new JAASUserInfo(userInfo));
currentUser = new JAASUserInfo(userInfo); setAuthenticated(currentUser.checkCredential(webCredential));
/** * binding authentication check * This method of authentication works only if the user branch of the DIT (ldap tree) * has an ACI (access control instruction) that allow the access to any user or at least * for the user that logs in. * * @param username * @param password * @return true always * @throws LoginException */ public boolean bindingLogin(String username, Object password) throws LoginException, NamingException { SearchResult searchResult = findUser(username); String userDn = searchResult.getNameInNamespace(); LOG.info("Attempting authentication: " + userDn); Hashtable<Object,Object> environment = getEnvironment(); environment.put(Context.SECURITY_PRINCIPAL, userDn); environment.put(Context.SECURITY_CREDENTIALS, password); DirContext dirContext = new InitialDirContext(environment); List<String> roles = getUserRolesByDn(dirContext, userDn); UserInfo userInfo = new UserInfo(username, null, roles); setCurrentUser(new JAASUserInfo(userInfo)); setAuthenticated(true); return true; }
/** * binding authentication check * This method of authentication works only if the user branch of the DIT (ldap tree) * has an ACI (access control instruction) that allow the access to any user or at least * for the user that logs in. * * @param username * @param password * @return true always * @throws LoginException */ public boolean bindingLogin(String username, Object password) throws LoginException, NamingException { SearchResult searchResult = findUser(username); String userDn = searchResult.getNameInNamespace(); LOG.info("Attempting authentication: " + userDn); Hashtable<Object,Object> environment = getEnvironment(); environment.put(Context.SECURITY_PRINCIPAL, userDn); environment.put(Context.SECURITY_CREDENTIALS, password); DirContext dirContext = new InitialDirContext(environment); List<String> roles = getUserRolesByDn(dirContext, userDn); UserInfo userInfo = new UserInfo(username, null, roles); setCurrentUser(new JAASUserInfo(userInfo)); setAuthenticated(true); return true; }
/** * @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#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; }
public JAASUserInfo (UserInfo u) { setUserInfo(u); }
public JAASUserInfo (UserInfo u) { setUserInfo(u); }
/** * 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#logout() * @return true always * @throws LoginException */ public boolean logout() throws LoginException { this.currentUser.unsetJAASInfo(this.subject); return true; }
/** * @see javax.security.auth.spi.LoginModule#logout() * @return true always * @throws LoginException */ public boolean logout() throws LoginException { this.currentUser.unsetJAASInfo(this.subject); return true; }
/** * 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(); }