
com.azure.identity.credential.ClientSecretCredentialBuilder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-identity Show documentation
Show all versions of azure-identity Show documentation
This module contains client library for Microsoft Azure Identity.
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
package com.azure.identity.credential;
import com.azure.identity.implementation.util.ValidationUtil;
import java.util.HashMap;
/**
* Fluent credential builder for instantiating a {@link ClientSecretCredential}.
*
* @see ClientSecretCredential
*/
public class ClientSecretCredentialBuilder extends AadCredentialBuilderBase {
private String clientSecret;
/**
* Sets the client secret for the authentication.
* @param clientSecret the secret value of the AAD application.
* @return the ClientSecretCredentialBuilder itself
*/
public ClientSecretCredentialBuilder clientSecret(String clientSecret) {
this.clientSecret = clientSecret;
return this;
}
/**
* @return a {@link ClientSecretCredentialBuilder} with the current configurations.
*/
public ClientSecretCredential build() {
ValidationUtil.validate(getClass().getSimpleName(), new HashMap() {{
put("clientId", clientId);
put("tenantId", tenantId);
put("clientSecret", clientSecret);
}});
return new ClientSecretCredential(tenantId, clientId, clientSecret, identityClientOptions);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy