Class ServiceAccountAuthorizer
An Unity.Cloud.Common.IServiceAuthorizer implementation that expects service account credentials from a provided launch argument or environment variable.
Implements
Inherited Members
Namespace: Unity.Cloud.Identity
Assembly: Unity.Cloud.Identity.dll
Syntax
public class ServiceAccountAuthorizer : IServiceAuthorizer
Examples
public class ServiceAccountAuthorizerExample : MonoBehaviour
{
IServiceAuthorizer m_ServiceAccountAuthorizer;
void Awake()
{
var authenticationPlatformSupport = PlatformSupportFactory.GetAuthenticationPlatformSupport();
m_ServiceAccountAuthorizer = new ServiceAccountAuthorizer(authenticationPlatformSupport);
}
}
Constructors
ServiceAccountAuthorizer(IAuthenticationPlatformSupport)
Returns an IAuthenticator implementation that expects service account credentials from a provided launch argument or environment variable.
Declaration
public ServiceAccountAuthorizer(IAuthenticationPlatformSupport authenticationPlatformSupport)
Parameters
Type | Name | Description |
---|---|---|
IAuthenticationPlatformSupport | authenticationPlatformSupport | The IAuthenticationPlatformSupport that handles credential injection. |
Remarks
The Unity service account must be created for the correct organization and have the correct permissions to access Unity Cloud APIs.
Exceptions
Type | Condition |
---|---|
InvalidOperationException | Thrown if no service account credentials are provided as a launch argument or environment variable. |
Fields
s_ServiceAccountKeyName
Returns the expected key name in launch arguments that holds the service account credentials in the <key id>:<secret key> format.
Declaration
public static readonly string s_ServiceAccountKeyName
Field Value
Type | Description |
---|---|
string |
Methods
AddAuthorization(HttpHeaders)
Applies authorization information to a given set of HttpHeaders.
Declaration
public Task AddAuthorization(HttpHeaders headers)
Parameters
Type | Name | Description |
---|---|---|
HttpHeaders | headers | The HttpHeaders to add authorization information to. |
Returns
Type | Description |
---|---|
Task | A Task for the operation. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if |