Long id = nextSubjectId++;
SubjectId subjectId;
try {
subjectId = new SubjectId(id, hash(id));
} catch (NoSuchAlgorithmException e) {
throw new ProviderException("No such algorithm: " + algorithm + ". This can be caused by a misconfigured java.ext.dirs, JAVA_HOME or JRE_HOME environment variable");
} catch (InvalidKeyException e) {
throw new ProviderException("Invalid key: " + key.toString());
}
IdentificationPrincipal principal = new IdentificationPrincipal(subjectId);
subject.getPrincipals().add(principal);
Context context = new Context(subjectId, acc, subject, callerPrincipal, groups);
subjectIds.put(context.getId(), subject);