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

com.azure.mixedreality.authentication.MixedRealityAccountKeyCredential Maven / Gradle / Ivy

There is a newer version: 1.2.28
Show newest version
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

package com.azure.mixedreality.authentication;

import com.azure.core.credential.AccessToken;
import com.azure.core.credential.AzureKeyCredential;
import com.azure.core.credential.TokenCredential;
import com.azure.core.credential.TokenRequestContext;
import reactor.core.publisher.Mono;

import java.time.OffsetDateTime;
import java.util.UUID;

class MixedRealityAccountKeyCredential implements TokenCredential {
    private final UUID accountId;
    private final AzureKeyCredential keyCredential;

    MixedRealityAccountKeyCredential(UUID accountId, AzureKeyCredential keyCredential) {
        this.accountId = accountId;
        this.keyCredential = keyCredential;
    }

    @Override
    public Mono getToken(TokenRequestContext tokenRequestContext) {
        String token = String.format("%s:%s", this.accountId.toString(), this.keyCredential.getKey());
        AccessToken result = new AccessToken(token, OffsetDateTime.MAX);

        return Mono.just(result);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy