use of javax.security.enterprise.credential.Credential in project Payara by payara.
the class RealmIdentityStore method validate.
protected CredentialValidationResult validate(UsernamePasswordCredential credential, String realmName) {
try {
Subject subject = login(credential, realmName);
Set<String> groups = subject.getPrincipals(Group.class).stream().map(g -> g.getName()).collect(toSet());
if (!groups.isEmpty()) {
return new CredentialValidationResult(new CallerPrincipal(credential.getCaller()), groups);
}
} catch (LoginException ex) {
return INVALID_RESULT;
}
return INVALID_RESULT;
}
use of javax.security.enterprise.credential.Credential in project Payara by payara.
the class CertificateRealmIdentityStore method validate.
public static CredentialValidationResult validate(CertificateCredential credential, String realmName) {
try {
Subject subject = login(credential, realmName);
Set<String> groups = subject.getPrincipals(Group.class).stream().map(g -> g.getName()).collect(toSet());
return new CredentialValidationResult(credential.getPrincipal(), groups);
} catch (LoginException ex) {
return INVALID_RESULT;
}
}
Aggregations