Search in sources :

Example 1 with SubjectProvider

use of com.mongodb.SubjectProvider in project mongo-java-driver by mongodb.

the class SaslAuthenticator method getSubjectProvider.

@NonNull
private SubjectProvider getSubjectProvider() {
    synchronized (getMongoCredentialWithCache()) {
        SubjectProvider subjectProvider = getMongoCredentialWithCache().getFromCache(SUBJECT_PROVIDER_CACHE_KEY, SubjectProvider.class);
        if (subjectProvider == null) {
            subjectProvider = getMongoCredential().getMechanismProperty(JAVA_SUBJECT_PROVIDER_KEY, null);
            if (subjectProvider == null) {
                subjectProvider = getDefaultSubjectProvider();
            }
            getMongoCredentialWithCache().putInCache(SUBJECT_PROVIDER_CACHE_KEY, subjectProvider);
        }
        return subjectProvider;
    }
}
Also used : SubjectProvider(com.mongodb.SubjectProvider) NonNull(com.mongodb.lang.NonNull)

Aggregations

SubjectProvider (com.mongodb.SubjectProvider)1 NonNull (com.mongodb.lang.NonNull)1