com.azure.mixedreality.authentication.MixedRealityAccountKeyCredential Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-mixedreality-authentication Show documentation
Show all versions of azure-mixedreality-authentication Show documentation
This package contains Microsoft Azure SDK for Mixed Reality Authentication.
The 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);
}
}