# クラス Authentication サブシステム

> Reference the Authentication Subsystem class for handling connections to Unity Authentication.

Unity Authentication システムへの接続を処理するためのサブシステム。

##### Include (含める)##include

```cpp
#include "AuthenticationSubsystem.h"
```

##### 構文##syntax

```cpp
UCLASS()
class AUTHENTICATION_API UAuthenticationSubsystem : public UGameInstanceSubsystem
```

## コンストラクター##constructors

### UAuthenticationSubsystem()##uauthenticationsubsystem()

Authentication サブシステムのデフォルトコンストラクター。

#### 宣言##declaration

```cpp
UAuthenticationSubsystem()
```

### UAuthenticationSubsystem(FVTableHelper&)##uauthenticationsubsystem(fvtablehelper&)

前方宣言のためのオーバーライドコンストラクター。

#### 宣言##declaration

```cpp
UAuthenticationSubsystem(FVTableHelper& Helper)
```

#### パラメーター##parameters

| **名前** | **説明**                             |
| :----- | :--------------------------------- |
| Helper | 特別なホットリロードコンストラクターを呼び出すためのヘルパークラス。 |

## デストラクター##destructors

### UAuthenticationSubsystem()##uauthenticationsubsystem()

Authentication サブシステムのデフォルトデストラクター。

#### 宣言##declaration

```cpp
virtual ~UAuthenticationSubsystem()
```

## Override##overrides

### Initialize(FSubsystemCollectionBase&)##initialize(fsubsystemcollectionbase&)

USubsystem からオーバーライドを初期化します。

#### 宣言##declaration

```cpp
virtual void Initialize(FSubsystemCollectionBase& Collection) override
```

### Deinitialize()##deinitialize()

USubsystem からオーバーライドを初期化します。

#### 宣言##declaration

```cpp
virtual void Deinitialize() override
```

### ShouldCreateSubsystem(UObject\*)##shouldcreatesubsystem(uobject\*)

USubsystem からオーバーライドを初期化します。

#### 宣言##declaration

```cpp
virtual bool ShouldCreateSubsystem(UObject* Outer) const override
```

## メソッド##methods

### SignInAnonymously(FAuthenticationSignInOptions, Unity::Services::Core::THandler\<FAuthenticationResponse>)##signinanonymously(fauthenticationsigninoptions,-unity::services::core::thandlerfauthenticationresponse)

現在のユーザーを匿名でサインインします。認証情報は必要なく、セッションは現在のデバイスに限定されます。

#### 宣言##declaration

```cpp
void SignInAnonymously(FAuthenticationSignInOptions Options, Unity::Services::Core::THandler<FAuthenticationResponse> ResponseHandler)
```

#### パラメーター##parameters

| **名前**            | **型**                                                                                                                                                         | **説明**                    |
| :---------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------ | :------------------------ |
| `Options`         | [FAuthenticationSignInOptions](./models/authentication-sign-in-options.md)                                                                                    | サインインのオプション。              |
| `ResponseHandler` | [THandler](/authentication-unreal/sdk-api/services-core/utils/services-utils.md#thandler)`<`[FAuthenticationResponse](./models/authentication-response.md)`>` | API が応答を返したときに実行されるハンドラー。 |

### GetUserInfo(Unity::Services::Core::THandler\<FAuthenticationUserResponse>)##getuserinfo(unity::services::core::thandlerfauthenticationuserresponse)

現在のプレイヤーの情報を返します (アカウント作成日時やリンクされた外部 ID など)。

#### 宣言##declaration

```cpp
void GetUserInfo(Unity::Services::Core::THandler<FAuthenticationUserResponse> ResponseHandler)
```

#### パラメーター##parameters

| **名前**            | **型**                                                                                                                                                                  | **説明**                    |
| :---------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------ |
| `ResponseHandler` | [THandler](/authentication-unreal/sdk-api/services-core/utils/services-utils.md#thandler)`<`[FAuthenticationUserResponse](./models/authentication-user-response.md)`>` | API が応答を返したときに実行されるハンドラー。 |

### DeleteUser(Unity::Services::Core::THandler\<bool>)##deleteuser(unity::services::core::thandlerbool)

現在サインインしているユーザーを完全に削除します。

#### 宣言##declaration

```cpp
void DeleteUser(Unity::Services::Core::THandler<bool> ResponseHandler)
```

#### パラメーター##parameters

| **名前**            | **型**                                                                                             | **説明**                    |
| :---------------- | :------------------------------------------------------------------------------------------------ | :------------------------ |
| `ResponseHandler` | [THandler](/authentication-unreal/sdk-api/services-core/utils/services-utils.md#thandler)`<bool>` | API が応答を返したときに実行されるハンドラー。 |

### RegisterStateChangedCallback(Unity::Services::Core::THandler\<FAuthenticationStateChangedResponse>)##registerstatechangedcallback(unity::services::core::thandlerfauthenticationstatechangedresponse)

認証状態が変更された際に実行されるデリゲートにフックします。

#### 宣言##declaration

```cpp
void RegisterStateChangedCallback(Unity::Services::Core::THandler<FAuthenticationStateChangedResponse> ResponseHandler)
```

#### パラメーター##parameters

| **名前**            | **型**                                                                                                                                                                                   | **説明**                  |
| :---------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :---------------------- |
| `ResponseHandler` | [THandler](/authentication-unreal/sdk-api/services-core/utils/services-utils.md#thandler)`<`[FAuthenticationStateChangedResponse](./models/authentication-state-changed-response.md)`>` | 認証状態が変更された際に実行されるハンドラー。 |

### SignOut(bool)##signout(bool)

指定されたプロファイル名で現在のユーザーをサインアウトします。

#### 宣言##declaration

```cpp
bool SignOut(bool bClearCredentials = false)
```

#### パラメーター##parameters

| **名前**              | **型**  | **説明**                                  |
| :------------------ | :----- | :-------------------------------------- |
| `bClearCredentials` | `bool` | 同じアカウントへのログインを可能にするセッショントークンを消去するオプション。 |

### SwitchProfile(const FString&)##switchprofile(const-fstring&)

現在のプロファイルを新しいプロファイル名に切り替えます。その名前のプロファイルが見つからなかった場合は、新しいプロファイルが作成されます。

#### 宣言##declaration

```cpp
void SwitchProfile(const FString& ProfileName) const
```

#### パラメーター##parameters

| **パラメーター名**   | **パラメーターの種類**                                                                           | **説明**                                    |
| :------------ | :-------------------------------------------------------------------------------------- | :---------------------------------------- |
| `ProfileName` | [FString](https://docs.unrealengine.com/5.3/en-US/API/Runtime/Core/Containers/FString/) | 切り替えるプロファイルの名前 (まだ存在しない場合は追加するプロファイルの名前)。 |

### ProfileExists(const FString&)##profileexists(const-fstring&)

プロファイルが存在するかどうかを確認します。

#### 宣言##declaration

```cpp
const bool ProfileExists(const FString& ProfileName) const
```

#### パラメーター##parameters

| **名前**        | **型**                                                                                   | **説明**         |
| :------------ | :-------------------------------------------------------------------------------------- | :------------- |
| `ProfileName` | [FString](https://docs.unrealengine.com/5.3/en-US/API/Runtime/Core/Containers/FString/) | 確認するプロファイルの名前。 |

#### 戻り値##returns

| **型**  | **説明**                              |
| :----- | :---------------------------------- |
| `bool` | プロファイルが存在する場合は true、存在しない場合は false。 |

### GetCurrentProfileName()##getcurrentprofilename()

現在のプロファイルの名前を返します。

#### 宣言##declaration

```cpp
const FString GetCurrentProfileName() const
```

#### 戻り値##returns

| **型**                                                                                   | **説明**        |
| :-------------------------------------------------------------------------------------- | :------------ |
| [FString](https://docs.unrealengine.com/5.3/en-US/API/Runtime/Core/Containers/FString/) | 現在のプロファイルの名前。 |

### GetProfileNames()##getprofilenames()

すべてのアクティブなプレイヤープロファイルの名前を返します。

#### 宣言##declaration

```cpp
const TArray<FString> GetProfileNames() const
```

#### 戻り値##returns

| **型**                                                                                                                                                                                 | **説明**                    |
| :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | :------------------------ |
| [TArray](https://docs.unrealengine.com/5.3/en-US/array-containers-in-unreal-engine/#tarray)\<[FString](https://docs.unrealengine.com/5.3/en-US/API/Runtime/Core/Containers/FString/)> | すべてのアクティブなプレイヤープロファイルの名前。 |

### RegisterProfileChangedCallback(Unity::Services::Core::THandler\<FAuthenticationPlayerProfileChangedResponse>)##registerprofilechangedcallback(unity::services::core::thandlerfauthenticationplayerprofilechangedresponse)

プレイヤープロファイルが変更された際に実行されるハンドラーにフックします。

#### 宣言##declaration

```cpp
void RegisterProfileChangedCallback(Unity::Services::Core::THandler<FAuthenticationPlayerProfileChangedResponse> ResponseHandler)
```

#### パラメーター##parameters

| **名前**            | **型**                                                                                                                                                                                                    | **説明**                         |
| :---------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----------------------------- |
| `ResponseHandler` | [THandler](/authentication-unreal/sdk-api/services-core/utils/services-utils.md#thandler)`<`[FAuthenticationPlayerProfileChangedResponse](./models/authentication-player-profile-changed-response.md)`>` | プレイヤープロファイルが変更された際に実行されるハンドラー。 |

### RegisterProfileDeletedCallback(Unity::Services::Core::THandler\<FAuthenticationPlayerProfileDeletedResponse> ResponseHandler)##registerprofiledeletedcallback(unity::services::core::thandlerfauthenticationplayerprofiledeletedresponse-responsehandler)

プレイヤープロファイルが削除された際に実行されるハンドラーにフックします。

#### 宣言##declaration

```cpp
void RegisterProfileDeletedCallback(Unity::Services::Core::THandler<FAuthenticationPlayerProfileDeletedResponse> ResponseHandler)
```

#### パラメーター##parameters

| **名前**            | **型**                                                                                                                                                                                                    | **説明**                         |
| :---------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----------------------------- |
| `ResponseHandler` | [THandler](/authentication-unreal/sdk-api/services-core/utils/services-utils.md#thandler)`<`[FAuthenticationPlayerProfileDeletedResponse](./models/authentication-player-profile-deleted-response.md)`>` | プレイヤープロファイルが削除された際に実行されるハンドラー。 |

### IsSignedIn()##issignedin()

ユーザーがサインインしているかどうかを確認します。

> **Note:**
>
> ユーザーはサインインしたままで、セッションが期限切れになることがあります。

#### 宣言##declaration

```cpp
bool IsSignedIn() const
```

#### 戻り値##returns

| **型**  | **説明**                                 |
| :----- | :------------------------------------- |
| `bool` | ユーザーがサインインしている場合は true、それ以外の場合は false。 |

### IsAnonymous()##isanonymous()

ユーザーが匿名でサインインしているかどうかを確認します。

#### 宣言##declaration

```cpp
bool IsAnonymous() const
```

#### 戻り値##returns

| **型**  | **説明**                                    |
| :----- | :---------------------------------------- |
| `bool` | ユーザーが匿名でサインインしている場合は true、それ以外の場合は false。 |

### IsAuthorized()##isauthorized()

ユーザーがまだ認証されているかどうかを確認します。

> **Note:**
>
> ユーザーは、アクセストークンが有効である限り、認証された状態で維持されます。

#### 宣言##declaration

```cpp
bool IsAuthorized() const
```

#### 戻り値##returns

| **型**  | **説明**                               |
| :----- | :----------------------------------- |
| `bool` | ユーザーが認証されている場合は true、それ以外の場合は false。 |

### IsExpired()##isexpired()

ユーザーセッションが期限切れかどうかを確認します。

#### 宣言##declaration

```cpp
bool IsExpired() const
```

#### 戻り値##returns

| **型**  | **説明**                                     |
| :----- | :----------------------------------------- |
| `bool` | ユーザーのセッションが期限切れである場合は true、それ以外の場合は false。 |

### SessionTokenExists()##sessiontokenexists()

現在のプロファイル用に保存されているセッショントークンがあるかどうかを確認します。

#### 宣言##declaration

```cpp
bool SessionTokenExists() const
```

#### 戻り値##returns

| **型**  | **説明**                                  |
| :----- | :-------------------------------------- |
| `bool` | 現在のプロファイル用に保存されているセッショントークンがある場合は true。 |

### GetUnityProjectId()##getunityprojectid()

Unity プロジェクト ID を返します。

#### 宣言##declaration

```cpp
const FGuid GetUnityProjectId() const
```

#### 戻り値##returns

| **型**                                                                         | **説明**           |
| :---------------------------------------------------------------------------- | :--------------- |
| [FGuid](https://docs.unrealengine.com/5.3/en-US/API/Runtime/Core/Misc/FGuid/) | Unity プロジェクト ID。 |

### GetUnityEnvironmentName()##getunityenvironmentname()

Unity 環境名を返します。

#### 宣言##declaration

```cpp
const FString GetUnityEnvironmentName() const
```

#### 戻り値##returns

| **型**                                                                                   | **説明**     |
| :-------------------------------------------------------------------------------------- | :--------- |
| [FString](https://docs.unrealengine.com/5.3/en-US/API/Runtime/Core/Containers/FString/) | Unity 環境名。 |

### GetAccessToken()##getaccesstoken()

現在のユーザーのアクセストークンを返します。

#### 宣言##declaration

```cpp
FString GetAccessToken() const
```

#### 戻り値##returns

| **型**                                                                                   | **説明**                                            |
| :-------------------------------------------------------------------------------------- | :------------------------------------------------ |
| [FString](https://docs.unrealengine.com/5.3/en-US/API/Runtime/Core/Containers/FString/) | 現在のユーザーがサインインしている場合はそのアクセストークンの文字列。それ以外の場合は空の文字列。 |

### GetSessionToken()##getsessiontoken()

現在のユーザーのセッショントークンを返します。

#### 宣言##declaration

```cpp
const const FString GetSessionToken() const
```

#### 戻り値##returns

| **型**                                                                                   | **説明**                                             |
| :-------------------------------------------------------------------------------------- | :------------------------------------------------- |
| [FString](https://docs.unrealengine.com/5.3/en-US/API/Runtime/Core/Containers/FString/) | 現在のユーザーがサインインしている場合はそのセッショントークンの文字列。それ以外の場合は空の文字列。 |

### GetUserId()##getuserid()

現在のユーザーがサインインしている場合は、そのユーザーの ID。

#### 宣言##declaration

```cpp
const FString GetUserId() const
```

#### 戻り値##returns

| **型**                                                                                   | **説明**                                        |
| :-------------------------------------------------------------------------------------- | :-------------------------------------------- |
| [FString](https://docs.unrealengine.com/5.3/en-US/API/Runtime/Core/Containers/FString/) | 現在のユーザーがサインインしている場合はそのユーザーの ID。それ以外の場合は空の文字列。 |

### GetState()##getstate()

認証サブシステムの現在の状態。

#### 宣言##declaration

```cpp
const EAuthenticationStates GetState() const
```

#### 戻り値##returns

| **型**                                               | **説明**          |
| :-------------------------------------------------- | :-------------- |
| [EAuthenticationStates](./authentication-states.md) | 認証サブシステムの現在の状態。 |

### SetUnityProjectId(FGuid)##setunityprojectid(fguid)

Unity プロジェクト ID を設定します。

#### 宣言##declaration

```cpp
void SetUnityProjectId(FGuid Value)
```

#### パラメーター##parameters

| **名前** | **型**                                                                         | **説明**               |
| :----- | :---------------------------------------------------------------------------- | :------------------- |
| 値      | [FGuid](https://docs.unrealengine.com/5.3/en-US/API/Runtime/Core/Misc/FGuid/) | 新しい Unity プロジェクト ID。 |

### SetUnityEnvironmentName(FString)##setunityenvironmentname(fstring)

Unity 環境名を設定します。

#### 宣言##declaration

```cpp
void SetUnityEnvironmentName(FString Value)
```

#### パラメーター##parameters

| **名前** | **型**                                                                                   | **説明**           |
| :----- | :-------------------------------------------------------------------------------------- | :--------------- |
| 値      | [FString](https://docs.unrealengine.com/5.3/en-US/API/Runtime/Core/Containers/FString/) | 新しい Unity 環境 ID。 |
