The preferred {@link ClientAuthenticationMethod} specified in the given
{@link OidcConfiguration}, or <code>null</code> meaning that the a
provider-supported method should be chosen.
778190
private static ClientAuthenticationMethod getPreferredAuthenticationMethod(OidcConfiguration config) {
        final ClientAuthenticationMethod configurationMethod = config.getClientAuthenticationMethod();
        if (configurationMethod == null) {
            return null;
        }
        
        if (!SUPPORTED_METHODS.contains(configurationMethod)) {
            throw new TechnicalException("Configured authentication method (" + configurationMethod + ") is not supported.");
        }
        
        return configurationMethod;
    }
738448
protected OAuthProviderToken createOAuthToken(ConsumerAuthentication authentication) {
    return getTokenServices().createUnauthorizedRequestToken(authentication.getConsumerDetails().getConsumerKey(),
                                                             authentication.getOAuthParameters().get(OAuthConsumerParameter.oauth_callback.toString()));
  }
770732
@Override
	public ProxyAuthenticationMethod getMethod() {
		switch (authenticationMethod) {
		case BASIC:
			return ProxyAuthenticationMethod.BASIC;
		case DIGEST:
			return ProxyAuthenticationMethod.DIGEST;
		case URL:
			return ProxyAuthenticationMethod.URL;
		default:
			return null;
		}
	}
783349
@SuppressWarnings("unchecked")
  @Override
  public <T extends OAuth2AuthorizedClient> T loadAuthorizedClient(
      String clientRegistrationId, String principalName) {
    Assert.hasText(clientRegistrationId, "clientRegistrationId cannot be empty");
    Assert.hasText(principalName, "principalName cannot be empty");
    ClientRegistration registration =
        this.clientRegistrationRepository.findByRegistrationId(clientRegistrationId);
    if (registration == null) {
      return null;
    }
    return (T) this.authorizedClients.get(this.getIdentifier(registration, principalName));
  }
537435
public ClientBuilderForConnector withCredentialsId(String credentialsId)
            throws UnrecoverableKeyException, NoSuchAlgorithmException, KeyStoreException, KeyManagementException {
        if (isNotBlank(credentialsId)) {
            withCredentials(lookupSystemCredentials(credentialsId));
        } else {
            withSslConfig(null);
        }

        return this;
    }
180221
protected JComboBox<AuthenticationMethodType> getAuthenticationMethodsComboBox() {
		if (authenticationMethodsComboBox == null) {
			Vector<AuthenticationMethodType> methods = new Vector<>(extension.getAuthenticationMethodTypes());
			authenticationMethodsComboBox = new JComboBox<>(methods);
			authenticationMethodsComboBox.setSelectedItem(null);

			// Prepare the listener for the change of selection
			authenticationMethodsComboBox.addItemListener(new ItemListener() {

				@Override
				public void itemStateChanged(ItemEvent e) {
					if (e.getStateChange() == ItemEvent.SELECTED && !e.getItem().equals(shownMethodType)) {
						log.debug("Selected new Authentication type: " + e.getItem());

						AuthenticationMethodType type = ((AuthenticationMethodType) e.getItem());
						if (shownMethodType == null || type.getAuthenticationCredentialsType() != shownMethodType
								.getAuthenticationCredentialsType()) {

							if (needsConfirm && !confirmAndResetUsersCredentials(type)) {
								log.debug("Cancelled change of authentication type.");

								authenticationMethodsComboBox.setSelectedItem(shownMethodType);
								return;
							}
						}
						resetLoggedInOutIndicators();

						// If no authentication method was previously selected or it's a different
						// class, create a new authentication method object
						if (selectedAuthenticationMethod == null
								|| !type.isTypeForMethod(selectedAuthenticationMethod)) {
							selectedAuthenticationMethod = type.createAuthenticationMethod(getContextIndex());
						}

						// Show the configuration panel
						changeMethodConfigPanel(type);
						if (type.hasOptionsPanel()) {
							shownConfigPanel.bindMethod(selectedAuthenticationMethod, getAuthenticationIndicatorsPanel());
						}
					}
				}
			});
		}
		return authenticationMethodsComboBox;
	}
778621
public static void putAuthenticationResultBuilder(final AuthenticationResultBuilder builder, final RequestContext ctx) {
        ctx.getConversationScope().put(PARAMETER_AUTHENTICATION_RESULT_BUILDER, builder);
    }
88641
function (authenticationRequest) {

            var authenticationProviders = this.$providers,
                provider;

            for (var i = 0; i < authenticationProviders.length; i++) {

                provider = authenticationProviders[i];

                if (provider.isResponsibleForAuthenticationRequest(authenticationRequest)) {
                    return provider;
                }
            }

            return null;

        }
946538
@Nullable
    public static StreamCipherProvider getProvider(@NotNull final String id) {
        for (final StreamCipherProvider provider : ServiceLoader.load(StreamCipherProvider.class)) {
            if (id.equalsIgnoreCase(provider.getId())) {
                return provider;
            }
        }
        return null;
    }
1071012
private String toApacheAuthenticationScheme(ProxyAuthenticationMethod authenticationMethod) {
        if (authenticationMethod == null) {
            throw new IllegalStateException("The configured proxy authentication methods must not be null.");
        }

        switch (authenticationMethod) {
            case NTLM: return AuthSchemes.NTLM;
            case BASIC: return AuthSchemes.BASIC;
            case DIGEST: return AuthSchemes.DIGEST;
            case SPNEGO: return AuthSchemes.SPNEGO;
            case KERBEROS: return AuthSchemes.KERBEROS;
            default: throw new IllegalStateException("Unknown authentication scheme: " + authenticationMethod);
        }
    }
164783
protected Service restoreAuthenticationRequestInContext(final RequestContext requestContext,
                                                            final J2EContext webContext,
                                                            final String clientName) {
        val logoutEndpoint = isLogoutRequest(webContext.getRequest());
        if (logoutEndpoint) {
            return null;
        } else {
            try {
                val client = (BaseClient<Credentials, CommonProfile>) this.clients.findClient(clientName);
                return delegatedClientWebflowManager.retrieve(requestContext, webContext, client);
            } catch (final Exception e) {
                LOGGER.error(e.getMessage(), e);
            }
            throw new UnauthorizedServiceException(UnauthorizedServiceException.CODE_UNAUTHZ_SERVICE, "Service unauthorized");
        }
    }
1224911
public static String getClientIdFromAuthenticatedProfile(final CommonProfile profile) {
        if (profile.containsAttribute(OAuth20Constants.CLIENT_ID)) {
            val attribute = profile.getAttribute(OAuth20Constants.CLIENT_ID);
            return CollectionUtils.toCollection(attribute, ArrayList.class).get(0).toString();
        }
        return null;
    }
223117
public static MethodIdentifier of(final String containingClass, final String methodName, final String signature, final boolean staticMethod) {
        final String returnType = JavaUtils.getReturnType(signature);
        final List<String> parameters = JavaUtils.getParameters(signature);
        return new MethodIdentifier(containingClass, methodName, parameters, returnType, staticMethod);
    }
716042
public boolean setAuthenticationMethod(int methodId, Authentication method) {
		if (methodId < 0 || methodId > 255)
			return false;
		if (method == null) {
			// Want to remove a particular method
			return (authMethods.remove(new Integer(methodId)) != null);
		} else {// Add the method, or rewrite old one
			authMethods.put(new Integer(methodId), method);
		}
		return true;
	}
211983
public void setCognitoIdentityProviders(java.util.Collection<CognitoIdentityProvider> cognitoIdentityProviders) {
        if (cognitoIdentityProviders == null) {
            this.cognitoIdentityProviders = null;
            return;
        }

        this.cognitoIdentityProviders = new java.util.ArrayList<CognitoIdentityProvider>(cognitoIdentityProviders);
    }
1015082
public AuthenticationService getAuthenticationService(SecurityService securityService) {
		if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
			SibTr.entry(tc, CLASS_NAME + "getAuthenticationService", securityService);
		}
		if(_authenticationService == null) {
			if (securityService != null)
				_authenticationService = securityService
						.getAuthenticationService();
		}
		if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
			SibTr.exit(tc, CLASS_NAME + "getAuthenticationService", _authenticationService);
		}
		return _authenticationService;
	}
973979
protected void configureOAuth20Client(final Collection<BaseClient> properties) {
        val index = new AtomicInteger();
        pac4jProperties.getOauth2()
            .stream()
            .filter(oauth -> StringUtils.isNotBlank(oauth.getId()) && StringUtils.isNotBlank(oauth.getSecret()))
            .forEach(oauth -> {
                val client = new GenericOAuth20Client();
                client.setKey(oauth.getId());
                client.setSecret(oauth.getSecret());
                client.setProfileAttrs(oauth.getProfileAttrs());
                client.setProfileNodePath(oauth.getProfilePath());
                client.setProfileUrl(oauth.getProfileUrl());
                client.setProfileVerb(Verb.valueOf(oauth.getProfileVerb().toUpperCase()));
                client.setTokenUrl(oauth.getTokenUrl());
                client.setAuthUrl(oauth.getAuthUrl());
                client.setCustomParams(oauth.getCustomParams());
                val count = index.intValue();
                if (StringUtils.isBlank(oauth.getClientName())) {
                    client.setName(client.getClass().getSimpleName() + count);
                }
                client.setCallbackUrlResolver(new PathParameterCallbackUrlResolver());
                configureClient(client, oauth);

                index.incrementAndGet();
                LOGGER.debug("Created client [{}]", client);
                properties.add(client);
            });
    }