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());
}
List<String> groups = Collections.emptyList();
Context context = new Context(subjectId, acc, subject, principal, groups);
subjectIds.put(context.getId(), subject);
subjectContexts.put(subject, context);