<commit_before>/*
 * JBoss, Home of Professional Open Source.
 * Copyright 2014 Red Hat, Inc., and individual contributors
 * as indicated by the @author tags.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.wildfly.security.auth.provider;

import javax.security.auth.Subject;
import javax.security.auth.callback.Callback;
import javax.security.auth.callback.CallbackHandler;
import javax.security.auth.callback.NameCallback;
import javax.security.auth.callback.PasswordCallback;
import javax.security.auth.callback.UnsupportedCallbackException;
import javax.security.auth.login.LoginContext;
import javax.security.auth.login.LoginException;

import java.io.IOException;
import java.lang.reflect.Method;
import java.security.AccessController;
import java.security.Principal;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
import java.security.acl.Group;
import java.util.Arrays;
import java.util.Enumeration;
import java.util.HashSet;
import java.util.Set;

import org.wildfly.common.Assert;
import org.wildfly.security._private.ElytronMessages;
import org.wildfly.security.auth.callback.CallbackUtil;
import org.wildfly.security.auth.principal.NamePrincipal;
import org.wildfly.security.authz.AuthorizationIdentity;
import org.wildfly.security.auth.server.RealmIdentity;
import org.wildfly.security.auth.server.RealmUnavailableException;
import org.wildfly.security.auth.server.SecurityRealm;
import org.wildfly.security.auth.server.SupportLevel;
import org.wildfly.security.credential.Credential;
import org.wildfly.security.evidence.Evidence;
import org.wildfly.security.evidence.PasswordGuessEvidence;
import org.wildfly.security.manager.WildFlySecurityManager;

/**
 * A JAAS based {@link SecurityRealm} implementation.
 *
 * @author <a href="mailto:<EMAIL>"><NAME></a>
 */
public class JaasSecurityRealm implements SecurityRealm {

    private final String loginConfiguration;

    private final CallbackHandler handler;
    private final Set<String> supportedCredentialNames;

    /**
     * Construct a new instance.
     *
     * @param loginConfiguration the login configuration name to use
     */
    public JaasSecurityRealm(final String loginConfiguration, final String... credentialNames) {
        this(loginConfiguration, null, credentialNames);
    }

    /**
     * Construct a new instance.
     *
     * @param loginConfiguration the login configuration name to use
     * @param handler the JAAS callback handler to use
     */
    public JaasSecurityRealm(final String loginConfiguration, final CallbackHandler handler, final String... credentialNames) {
        this.loginConfiguration = loginConfiguration;
        this.handler = handler;<commit_msg>[ELY-347] Added missing new parameters to the javadoc.<commit_after>/*
 * JBoss, Home of Professional Open Source.
 * Copyright 2014 Red Hat, Inc., and individual contributors
 * as indicated by the @author tags.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.wildfly.security.auth.provider;

import javax.security.auth.Subject;
import javax.security.auth.callback.Callback;
import javax.security.auth.callback.CallbackHandler;
import javax.security.auth.callback.NameCallback;
import javax.security.auth.callback.PasswordCallback;
import javax.security.auth.callback.UnsupportedCallbackException;
import javax.security.auth.login.LoginContext;
import javax.security.auth.login.LoginException;

import java.io.IOException;
import java.lang.reflect.Method;
import java.security.AccessController;
import java.security.Principal;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
import java.security.acl.Group;
import java.util.Arrays;
import java.util.Enumeration;
import java.util.HashSet;
import java.util.Set;

import org.wildfly.common.Assert;
import org.wildfly.security._private.ElytronMessages;
import org.wildfly.security.auth.callback.CallbackUtil;
import org.wildfly.security.auth.principal.NamePrincipal;
import org.wildfly.security.authz.AuthorizationIdentity;
import org.wildfly.security.auth.server.RealmIdentity;
import org.wildfly.security.auth.server.RealmUnavailableException;
import org.wildfly.security.auth.server.SecurityRealm;
import org.wildfly.security.auth.server.SupportLevel;
import org.wildfly.security.credential.Credential;
import org.wildfly.security.evidence.Evidence;
import org.wildfly.security.evidence.PasswordGuessEvidence;
import org.wildfly.security.manager.WildFlySecurityManager;

/**
 * A JAAS based {@link SecurityRealm} implementation.
 *
 * @author <a href="mailto:<EMAIL>"><NAME></a>
 */
public class JaasSecurityRealm implements SecurityRealm {

    private final String loginConfiguration;

    private final CallbackHandler handler;
    private final Set<String> supportedCredentialNames;

    /**
     * Construct a new instance.
     *
     * @param loginConfiguration the login configuration name to use
     * @param credentialNames the credential names this realm will claim to be able to verify
     */
    public JaasSecurityRealm(final String loginConfiguration, final String... credentialNames) {
        this(loginConfiguration, null, credentialNames);
    }

    /**
     * Construct a new instance.
     *
     * @param loginConfiguration the login configuration name to use
     * @param handler the JAAS callback handler to use
     * @param credentialNames the credential names this realm will claim to be able to verify
     */
    public JaasSecurityRealm(final String loginConfiguration, final CallbackHandler handler, final String... credentialNames) {
        this.loginConfiguration = loginConfiguration;
        this.handler = handler;
{'fraction_non_alphanumeric': 0.08527707621452979, 'fraction_numerical': 0.002822760362501857, 'mean_word_length': 4.666666666666667, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5013715', 'n_tokens_mistral': 1815, 'n_tokens_neox': 1744, 'n_words': 528}