All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.microsoft.aad.msal4j.ClientInfo Maven / Gradle / Ivy

Go to download

Microsoft Authentication Library for Java gives you the ability to obtain tokens from Azure AD v2 (work and school accounts, MSA) and Azure AD B2C, gaining access to Microsoft Cloud API and any other API secured by Microsoft identities

There is a newer version: 1.18.0
Show newest version
// Generated by delombok at Fri Jul 26 21:46:44 UTC 2024
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
package com.microsoft.aad.msal4j;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.nimbusds.jose.util.StandardCharset;
import java.util.Base64;
import static com.microsoft.aad.msal4j.Constants.POINT_DELIMITER;

class ClientInfo {
    @JsonProperty("uid")
    private String uniqueIdentifier;
    @JsonProperty("utid")
    private String uniqueTenantIdentifier;

    public static ClientInfo createFromJson(String clientInfoJsonBase64Encoded) {
        if (StringHelper.isBlank(clientInfoJsonBase64Encoded)) {
            return null;
        }
        byte[] decodedInput = Base64.getUrlDecoder().decode(clientInfoJsonBase64Encoded.getBytes(StandardCharset.UTF_8));
        return JsonHelper.convertJsonToObject(new String(decodedInput, StandardCharset.UTF_8), ClientInfo.class);
    }

    String toAccountIdentifier() {
        return uniqueIdentifier + POINT_DELIMITER + uniqueTenantIdentifier;
    }

    @java.lang.SuppressWarnings("all")
    String getUniqueIdentifier() {
        return this.uniqueIdentifier;
    }

    @java.lang.SuppressWarnings("all")
    String getUniqueTenantIdentifier() {
        return this.uniqueTenantIdentifier;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy