private static ClientAuthenticationMethod getClientAuthenticationMethod(
			List<com.nimbusds.oauth2.sdk.auth.ClientAuthenticationMethod> metadataAuthMethods) {
		if (metadataAuthMethods == null || metadataAuthMethods
			.contains(com.nimbusds.oauth2.sdk.auth.ClientAuthenticationMethod.CLIENT_SECRET_BASIC)) {
			// If null, the default includes client_secret_basic
			return ClientAuthenticationMethod.CLIENT_SECRET_BASIC;
		}
		if (metadataAuthMethods.contains(com.nimbusds.oauth2.sdk.auth.ClientAuthenticationMethod.CLIENT_SECRET_POST)) {
			return ClientAuthenticationMethod.CLIENT_SECRET_POST;
		}
		if (metadataAuthMethods.contains(com.nimbusds.oauth2.sdk.auth.ClientAuthenticationMethod.NONE)) {
			return ClientAuthenticationMethod.NONE;
		}
		return null;
	}
@Test
	public void buildWhenClientRegistrationProvidedThenEachPropertyMatches() {
		ClientRegistration clientRegistration = TestClientRegistrations.clientRegistration().build();
		ClientRegistration updated = ClientRegistration.withClientRegistration(clientRegistration).build();
		assertThat(clientRegistration.getRegistrationId()).isEqualTo(updated.getRegistrationId());
		assertThat(clientRegistration.getClientId()).isEqualTo(updated.getClientId());
		assertThat(clientRegistration.getClientSecret()).isEqualTo(updated.getClientSecret());
		assertThat(clientRegistration.getClientAuthenticationMethod())
			.isEqualTo(updated.getClientAuthenticationMethod());
		assertThat(clientRegistration.getAuthorizationGrantType()).isEqualTo(updated.getAuthorizationGrantType());
		assertThat(clientRegistration.getRedirectUri()).isEqualTo(updated.getRedirectUri());
		assertThat(clientRegistration.getScopes()).isEqualTo(updated.getScopes());
		ClientRegistration.ProviderDetails providerDetails = clientRegistration.getProviderDetails();
		ClientRegistration.ProviderDetails updatedProviderDetails = updated.getProviderDetails();
		assertThat(providerDetails.getAuthorizationUri()).isEqualTo(updatedProviderDetails.getAuthorizationUri());
		assertThat(providerDetails.getTokenUri()).isEqualTo(updatedProviderDetails.getTokenUri());
		ClientRegistration.ProviderDetails.UserInfoEndpoint userInfoEndpoint = providerDetails.getUserInfoEndpoint();
		ClientRegistration.ProviderDetails.UserInfoEndpoint updatedUserInfoEndpoint = updatedProviderDetails
			.getUserInfoEndpoint();
		assertThat(userInfoEndpoint.getUri()).isEqualTo(updatedUserInfoEndpoint.getUri());
		assertThat(userInfoEndpoint.getAuthenticationMethod())
			.isEqualTo(updatedUserInfoEndpoint.getAuthenticationMethod());
		assertThat(userInfoEndpoint.getUserNameAttributeName())
			.isEqualTo(updatedUserInfoEndpoint.getUserNameAttributeName());
		assertThat(providerDetails.getJwkSetUri()).isEqualTo(updatedProviderDetails.getJwkSetUri());
		assertThat(providerDetails.getIssuerUri()).isEqualTo(updatedProviderDetails.getIssuerUri());
		assertThat(providerDetails.getConfigurationMetadata())
			.isEqualTo(updatedProviderDetails.getConfigurationMetadata());
		assertThat(clientRegistration.getClientName()).isEqualTo(updated.getClientName());
	}