You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

180 lines
4.9 KiB

// Copyright Epic Games, Inc. All Rights Reserved.
// This file is automatically generated. Changes to this file may be overwritten.
namespace Epic.OnlineServices.Auth
{
/// <summary>
/// A structure that contains login credentials. What is required is dependent on the type of login being initiated.
///
/// This is part of the input structure <see cref="LoginOptions" /> and related to device auth.
///
/// Use of the ID and Token fields differs based on the Type. They should be null, unless specified:
/// <see cref="LoginCredentialType.Password" /> - ID is the email address, and Token is the password.
/// <see cref="LoginCredentialType.ExchangeCode" /> - Token is the exchange code.
/// <see cref="LoginCredentialType.PersistentAuth" /> - If targeting console platforms, Token is the long lived refresh token. Otherwise N/A.
/// <see cref="LoginCredentialType.DeviceCode" /> - N/A.
/// <see cref="LoginCredentialType.Developer" /> - ID is the host (e.g. localhost:6547), and Token is the credential name registered in the EOS Developer Authentication Tool.
/// <see cref="LoginCredentialType.RefreshToken" /> - Token is the refresh token.
/// <see cref="LoginCredentialType.AccountPortal" /> - SystemAuthCredentialsOptions may be required if targeting mobile platforms. Otherwise N/A.
/// <see cref="LoginCredentialType.ExternalAuth" /> - Token is the external auth token specified by ExternalType.
/// <seealso cref="LoginCredentialType" />
/// <seealso cref="AuthInterface.Login" />
/// <seealso cref="DeletePersistentAuthOptions" />
/// </summary>
public struct Credentials
{
/// <summary>
/// ID of the user logging in, based on <see cref="LoginCredentialType" />
/// </summary>
public Utf8String Id { get; set; }
/// <summary>
/// Credentials or token related to the user logging in
/// </summary>
public Utf8String Token { get; set; }
/// <summary>
/// Type of login. Needed to identify the auth method to use
/// </summary>
public LoginCredentialType Type { get; set; }
/// <summary>
/// This field is for system specific options, if any.
///
/// If provided, the structure will be located in (System)/eos_(system).h.
/// The structure will be named EOS_(System)_Auth_CredentialsOptions.
/// </summary>
public System.IntPtr SystemAuthCredentialsOptions { get; set; }
/// <summary>
/// Type of external login. Needed to identify the external auth method to use.
/// Used when login type is set to <see cref="LoginCredentialType.ExternalAuth" />, ignored for other <see cref="LoginCredentialType" /> methods.
/// </summary>
public ExternalCredentialType ExternalType { get; set; }
internal void Set(ref CredentialsInternal other)
{
Id = other.Id;
Token = other.Token;
Type = other.Type;
SystemAuthCredentialsOptions = other.SystemAuthCredentialsOptions;
ExternalType = other.ExternalType;
}
}
[System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Sequential, Pack = 8)]
internal struct CredentialsInternal : IGettable<Credentials>, ISettable<Credentials>, System.IDisposable
{
private int m_ApiVersion;
private System.IntPtr m_Id;
private System.IntPtr m_Token;
private LoginCredentialType m_Type;
private System.IntPtr m_SystemAuthCredentialsOptions;
private ExternalCredentialType m_ExternalType;
public Utf8String Id
{
get
{
Utf8String value;
Helper.Get(m_Id, out value);
return value;
}
set
{
Helper.Set(value, ref m_Id);
}
}
public Utf8String Token
{
get
{
Utf8String value;
Helper.Get(m_Token, out value);
return value;
}
set
{
Helper.Set(value, ref m_Token);
}
}
public LoginCredentialType Type
{
get
{
return m_Type;
}
set
{
m_Type = value;
}
}
public System.IntPtr SystemAuthCredentialsOptions
{
get
{
return m_SystemAuthCredentialsOptions;
}
set
{
m_SystemAuthCredentialsOptions = value;
}
}
public ExternalCredentialType ExternalType
{
get
{
return m_ExternalType;
}
set
{
m_ExternalType = value;
}
}
public void Set(ref Credentials other)
{
m_ApiVersion = AuthInterface.CredentialsApiLatest;
Id = other.Id;
Token = other.Token;
Type = other.Type;
SystemAuthCredentialsOptions = other.SystemAuthCredentialsOptions;
ExternalType = other.ExternalType;
}
public void Set(ref Credentials? other)
{
if (other.HasValue)
{
m_ApiVersion = AuthInterface.CredentialsApiLatest;
Id = other.Value.Id;
Token = other.Value.Token;
Type = other.Value.Type;
SystemAuthCredentialsOptions = other.Value.SystemAuthCredentialsOptions;
ExternalType = other.Value.ExternalType;
}
}
public void Dispose()
{
Helper.Dispose(ref m_Id);
Helper.Dispose(ref m_Token);
Helper.Dispose(ref m_SystemAuthCredentialsOptions);
}
public void Get(out Credentials output)
{
output = new Credentials();
output.Set(ref this);
}
}
}