private SecurityHandler makeSecurityHandler(String realm, String consoleUser, String consolePassword, String curatorUser, String curatorPassword) userRealm.put(consoleUser, Credential.getCredential(consolePassword)); userRealm.addUserToRole(consoleUser,"console"); userRealm.put(curatorUser, Credential.getCredential(curatorPassword)); userRealm.addUserToRole(curatorUser, "curator");
/** Put user into realm. * @param name User name * @param credentials String password, Password or UserPrinciple * instance. * @return Old UserPrinciple value or null */ public synchronized Object put(Object name, Object credentials) { if (credentials instanceof Principal) return _users.put(name.toString(),credentials); if (credentials instanceof Password) return _users.put(name,new KnownUser(name.toString(),(Password)credentials)); if (credentials != null) return _users.put(name,new KnownUser(name.toString(),Credential.getCredential(credentials.toString()))); return null; }
/** Put user into realm. * @param name User name * @param credentials String password, Password or UserPrinciple * instance. * @return Old UserPrinciple value or null */ public synchronized Object put(Object name, Object credentials) { if (credentials instanceof Principal) return _users.put(name.toString(),credentials); if (credentials instanceof Password) return _users.put(name,new KnownUser(name.toString(),(Password)credentials)); if (credentials != null) return _users.put(name,new KnownUser(name.toString(),Credential.getCredential(credentials.toString()))); return null; }