@Override public Set<Principal> getPrincipals() { Set<Principal> groups = new HashSet<Principal>(); groups.add(new GroupPrincipal(anonymousGroup)); return groups; } };
@Override public void initialize(Subject subject, CallbackHandler callbackHandler, Map sharedState, Map options) { this.subject = subject; this.callbackHandler = callbackHandler; debug = "true".equalsIgnoreCase((String)options.get("debug")); credentialsInvalidate = "true".equalsIgnoreCase((String)options.get("credentialsInvalidate")); if (options.get(GUEST_USER) != null) { userName = (String)options.get(GUEST_USER); } if (options.get(GUEST_GROUP) != null) { groupName = (String)options.get(GUEST_GROUP); } principals.add(new UserPrincipal(userName)); principals.add(new GroupPrincipal(groupName)); if (debug) { LOG.debug("Initialized debug=" + debug + " guestUser=" + userName + " guestGroup=" + groupName); } }
@Override public boolean commit() throws LoginException { if (!succeeded) { clear(); if (debug) { LOG.debug("commit, result: false"); } return false; } principals.add(new UserPrincipal(user)); Set<String> matchedGroups = groups.get(user); if (matchedGroups != null) { for (String entry : matchedGroups) { principals.add(new GroupPrincipal(entry)); } } subject.getPrincipals().addAll(principals); if (debug) { LOG.debug("commit, result: true"); } commitSucceeded = true; return true; }
/** * Sets individual users for authentication * * @org.apache.xbean.ElementType class="org.apache.activemq.security.AuthenticationUser" */ public void setUsers(List<?> users) { userPasswords.clear(); userGroups.clear(); for (Iterator<?> it = users.iterator(); it.hasNext();) { AuthenticationUser user = (AuthenticationUser)it.next(); userPasswords.put(user.getUsername(), user.getPassword()); Set<Principal> groups = new HashSet<Principal>(); StringTokenizer iter = new StringTokenizer(user.getGroups(), ","); while (iter.hasMoreTokens()) { String name = iter.nextToken().trim(); groups.add(new GroupPrincipal(name)); } userGroups.put(user.getUsername(), groups); } }
/** * Overriding to complete login process. Standard JAAS. */ @Override public boolean commit() throws LoginException { if (debug) { LOG.debug("commit"); } if (!succeeded) { clear(); return false; } principals.add(new UserPrincipal(username)); for (String group : getUserGroups(username)) { principals.add(new GroupPrincipal(group)); } subject.getPrincipals().addAll(principals); username = null; commitSucceeded = true; return true; }
protected Set<GroupPrincipal> getACLs(String destinationBase, SearchControls constraints, String roleBase, String roleAttribute) { try { Set<GroupPrincipal> roles = new HashSet<GroupPrincipal>(); Set<String> acls = new HashSet<String>(); NamingEnumeration<?> results = context.search(destinationBase, roleBase, constraints); while (results.hasMore()) { SearchResult result = (SearchResult)results.next(); Attributes attrs = result.getAttributes(); if (attrs == null) { continue; } acls = addAttributeValues(roleAttribute, attrs, acls); } for (Iterator<String> iter = acls.iterator(); iter.hasNext();) { String roleName = iter.next(); LdapName ldapname = new LdapName(roleName); Rdn rdn = ldapname.getRdn(ldapname.size() - 1); LOG.debug("Found role: [" + rdn.getValue().toString() + "]"); roles.add(new GroupPrincipal(rdn.getValue().toString())); } return roles; } catch (NamingException e) { LOG.error(e.toString()); return new HashSet<GroupPrincipal>(); } }
groups.add(new GroupPrincipal(roles.get(i)));
@Override public Set<Principal> getPrincipals() { Set<Principal> groups = new HashSet<>(); groups.add(new GroupPrincipal(vmGroup)); return groups; } };
@Override public Set<Principal> getPrincipals() { Set<Principal> groups = new HashSet<Principal>(); groups.add(new GroupPrincipal(anonymousGroup)); return groups; } };
@Override public Set<Principal> getPrincipals() { Set<Principal> groups = new HashSet<Principal>(); groups.add(new GroupPrincipal(anonymousGroup)); return groups; } };
public Set getPrincipals() { Set groups = new HashSet(); groups.add(new GroupPrincipal(anonymousGroup)); return groups; } };
@Override public Set<Principal> getPrincipals() { Set<Principal> groups = new HashSet<Principal>(); groups.add(new GroupPrincipal(anonymousGroup)); return groups; } };
@Override public void initialize(Subject subject, CallbackHandler callbackHandler, Map sharedState, Map options) { this.subject = subject; this.callbackHandler = callbackHandler; debug = "true".equalsIgnoreCase((String)options.get("debug")); credentialsInvalidate = "true".equalsIgnoreCase((String)options.get("credentialsInvalidate")); if (options.get(GUEST_USER) != null) { userName = (String)options.get(GUEST_USER); } if (options.get(GUEST_GROUP) != null) { groupName = (String)options.get(GUEST_GROUP); } principals.add(new UserPrincipal(userName)); principals.add(new GroupPrincipal(groupName)); if (debug) { LOG.debug("Initialized debug=" + debug + " guestUser=" + userName + " guestGroup=" + groupName); } }
@Override public void initialize(Subject subject, CallbackHandler callbackHandler, Map sharedState, Map options) { this.subject = subject; this.callbackHandler = callbackHandler; debug = "true".equalsIgnoreCase((String)options.get("debug")); credentialsInvalidate = "true".equalsIgnoreCase((String)options.get("credentialsInvalidate")); if (options.get(GUEST_USER) != null) { userName = (String)options.get(GUEST_USER); } if (options.get(GUEST_GROUP) != null) { groupName = (String)options.get(GUEST_GROUP); } principals.add(new UserPrincipal(userName)); principals.add(new GroupPrincipal(groupName)); if (debug) { LOG.debug("Initialized debug=" + debug + " guestUser=" + userName + " guestGroup=" + groupName); } }
@Override public boolean commit() throws LoginException { boolean result = loginSucceeded; if (result) { principals.add(new UserPrincipal(user)); Set<String> matchedGroups = groups.get(user); if (matchedGroups != null) { for (String entry : matchedGroups) { principals.add(new GroupPrincipal(entry)); } } subject.getPrincipals().addAll(principals); } // will whack loginSucceeded clear(); if (debug) { LOG.debug("commit, result: " + result); } return result; }
/** * Overriding to complete login process. Standard JAAS. */ @Override public boolean commit() throws LoginException { principals.add(new UserPrincipal(username)); for (String group : getUserGroups(username)) { principals.add(new GroupPrincipal(group)); } subject.getPrincipals().addAll(principals); clear(); if (debug) { LOG.debug("commit"); } return true; }
@Override public boolean commit() throws LoginException { boolean result = loginSucceeded; if (result) { principals.add(new UserPrincipal(user)); Set<String> matchedGroups = groups.get(user); if (matchedGroups != null) { for (String entry : matchedGroups) { principals.add(new GroupPrincipal(entry)); } } subject.getPrincipals().addAll(principals); } // will whack loginSucceeded clear(); if (debug) { LOG.debug("commit, result: " + result); } return result; }
/** * Sets individual users for authentication * * @org.apache.xbean.ElementType class="org.apache.activemq.security.AuthenticationUser" */ public void setUsers(List<?> users) { userPasswords.clear(); userGroups.clear(); for (Iterator<?> it = users.iterator(); it.hasNext();) { AuthenticationUser user = (AuthenticationUser)it.next(); userPasswords.put(user.getUsername(), user.getPassword()); Set<Principal> groups = new HashSet<Principal>(); StringTokenizer iter = new StringTokenizer(user.getGroups(), ","); while (iter.hasMoreTokens()) { String name = iter.nextToken().trim(); groups.add(new GroupPrincipal(name)); } userGroups.put(user.getUsername(), groups); } }
/** * Overriding to complete login process. Standard JAAS. */ @Override public boolean commit() throws LoginException { principals.add(new UserPrincipal(username)); for (String group : getUserGroups(username)) { principals.add(new GroupPrincipal(group)); } subject.getPrincipals().addAll(principals); clear(); if (debug) { LOG.debug("commit"); } return true; }
/** * Sets individual users for authentication * * @org.apache.xbean.ElementType class="org.apache.activemq.security.AuthenticationUser" */ public void setUsers(List users) { userPasswords = new HashMap<String, String>(); userGroups = new HashMap<String, Set<GroupPrincipal>>(); for (Iterator it = users.iterator(); it.hasNext();) { AuthenticationUser user = (AuthenticationUser)it.next(); userPasswords.put(user.getUsername(), user.getPassword()); Set<GroupPrincipal> groups = new HashSet<GroupPrincipal>(); StringTokenizer iter = new StringTokenizer(user.getGroups(), ","); while (iter.hasMoreTokens()) { String name = iter.nextToken().trim(); groups.add(new GroupPrincipal(name)); } userGroups.put(user.getUsername(), groups); } }