use of org.eclipse.jetty.util.security.Credential in project zm-mailbox by Zimbra.
the class ZimbraLoginService method makeUserIdentity.
UserIdentity makeUserIdentity(String userName) {
// blank password/credentials. this is just a placeholder; we always
// check credentials via prov on each login
Credential credential = Credential.getCredential("");
// only need 'user' role for current implementation protecting
// /zimbra/downloads - expand to admin if needed later
String roleName = "user";
Principal userPrincipal = new KnownUser(userName, credential);
Subject subject = new Subject();
subject.getPrincipals().add(userPrincipal);
subject.getPrivateCredentials().add(credential);
subject.getPrincipals().add(new RolePrincipal(roleName));
subject.setReadOnly();
UserIdentity identity = identityService.newUserIdentity(subject, userPrincipal, new String[] { roleName });
return identity;
}
use of org.eclipse.jetty.util.security.Credential in project jena by apache.
the class FusekiTestAuth method makeUserStore.
/** Very simple! */
private static UserStore makeUserStore(String user, String password, String role) {
Credential cred = new Password(password);
PropertyUserStore propertyUserStore = new PropertyUserStore();
String[] roles = role == null ? null : new String[] { role };
propertyUserStore.addUser(user, cred, roles);
try {
propertyUserStore.start();
} catch (Exception ex) {
throw new FusekiException("UserStore", ex);
}
return propertyUserStore;
}
Aggregations