use of org.eclipse.jetty.security.MappedLoginService.KnownUser 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;
}
Aggregations