# ログインコマンド

### コマンド

1. [認証 (ログイン) コマンド](#login-command)
2. [ログアウトコマンド](#logout-command)
3. [ログインユーザー情報表示コマンド](#whoami-command)

Keeperには複数のログイン方式があり、次を含みます。

### 認証の流れ (概要)

* **一次認証**
  * 通常アカウント (ユーザー名とマスターパスワード)
  * クラウドSSO (SAML、OIDC)
  * オンプレミスSSO
  * MSP (マネージド企業) ログイン
* **二次認証 (2FA)**
  * TOTP (Google/Microsoft Authenticator)
  * SMSワンタイムコード
  * DUO (プッシュ、SMS、音声)
  * RSA SecurID
  * WebAuthn/U2F (セキュリティキー、生体認証)
* **デバイス承認**
  * メールのリンク
  * 2FAチャレンジ
  * Keeperプッシュ通知

### SDK認証の流れ

1. **SDKクライアントまたはセッションコンテキストの初期化**
2. **ログイン方式の選択** (マスターパスワード、SSO、MSP)
3. **Keeperから発行されるチャレンジへの対応**
   * 2FAチャレンジ
   * デバイス承認
   * セキュリティキーのプロンプト
4. **セキュアセッションの確立**
   * 暗号化されたセッショントークンの受信
   * ボルトおよびエンタープライズAPIのロック解除

### 認証 (ログイン) コマンド <a href="#login-command" id="login-command"></a>

セッション開始のための認証を行います。

<details>

<summary>DotNet CLI</summary>

**コマンド:** `login`

**フラグ:**

* `--password` マスターパスワード
* `--resume` 前回のログインを再開する
* `--sso` SSOプロバイダーでログインする
* `--alt` SSOのマスターパスワードでログインする
* `--help` このヘルプを表示する。
* `--version` バージョン情報を表示する。
* `email (pos. 0)` 必須。アカウントのメール

**例:**

```bash
Not logged in> login user@example.com --password 1234567890qwertyuiop
```

</details>

<details>

<summary>DotNet SDK</summary>

**メソッド:** `IAuth.Login`

```csharp
 public async Task Login(string username, params string[] passwords)
```

**例:**

```csharp
 await auth.Login(email, passwds.ToArray());
```

</details>

<details>

<summary>PowerCommander</summary>

**コマンド:** `Connect-Keeper`\
**別名:** `kc`

**フラグ:**

* `-Username`
* `-Password`
* `-NewLogin`
* `-Server`
* `-Config`
* `-SsoPassword`
* `-SsoProvider`<br>

**例:**

<pre class="language-powershell"><code class="lang-powershell"><strong>PS > Connect-Keeper -Username "your@email.com" -Password (Read-Host -AsSecureString -Prompt "yourpassword")
</strong></code></pre>

本コマンドの使い方について、詳しくは[こちら](https://github.com/Keeper-Security/gitbook-jp-secrets-manager/blob/main/commander-sdk/keeper-commander-sdks/sdk-command-reference/login-commands/powercommander-login.md)をご参照ください。

</details>

<details>

<summary>Python CLI</summary>

**コマンド:** `login`

**フラグ:**

* `-h, --help` : ヘルプを表示して終了する
* `--sso-password` : SSOアカウントでマスターパスワードを強制する
* `--resume-session` : 現在のログインセッションを再開する
* `-p, --pass` : PASSWORD マスターパスワード<br>

**例:**

```bash
My Vault > login user@example.com --pass qwertyuiop1234567890
```

</details>

<details>

<summary>Python SDK</summary>

**関数:** [詳細はこちらをご参照ください](https://github.com/Keeper-Security/gitbook-jp-secrets-manager/blob/main/commander-cli/commander-installation-setup/developer-mode/commander-sdk-for-python/README.md#create-an-application)

</details>

### ログアウトコマンド <a href="#logout-command" id="logout-command"></a>

CLIから安全にログアウトします。

<details>

<summary>DotNet CLI</summary>

**コマンド:** `logout`

**フラグ:**

* `--resume` : 前回のログインを再開する
* `--help` : このヘルプを表示する。
* `--version` : バージョン情報を表示する。

**例:**

```bash
My Vault > logout
```

</details>

<details>

<summary>DotNet SDK</summary>

**メソッド:** `IAuthentication.Logout`

```csharp
public virtual async Task Logout()
```

**例:**

```csharp
await DoLogout();
```

</details>

<details>

<summary>PowerCommander</summary>

**コマンド:** `Disconnect-Keeper`

**別名:** `kq`

**フラグ:**

* `-Resume`

**例:**

```powershell
PS > Disconnect-Keeper 

PS > kq
```

</details>

<details>

<summary>Python CLI</summary>

**コマンド:** `logout`

**例:**

```bash
My Vault > logout 
```

</details>

<details>

<summary>Python SDK</summary>

**関数:** `close`

**例:**

```
vault.close()
keeper_auth.close()
```

</details>

### ログインユーザー情報表示コマンド <a href="#whoami-command" id="whoami-command"></a>

現在認証済みのユーザーについて、ユーザー名とメールを含む情報を表示します。

<details>

<summary>DotNet CLI</summary>

**コマンド:** `whoami`

**例:**

```bash
My Vault > whoami
            User:  user@example.com
          Server:  keepersecurity.com      
     Data Center:  US                      
           Admin:  Yes                     
    Account Type:  2                       
    Renewal Date:  May 28, 2027            
Storage Capacity:  1024GB                  
   Storage Usage:  0GB                     
 Storage Expires:  May 28, 2027            
    License Type:  Keeper for Business     
 License Expires:  May 28, 2027            
       Base Plan:  Enterprise              
     BreachWatch:  Yes     
```

</details>

<details>

<summary>DotNet SDK</summary>

**メソッド:** `Authentication.IAuthContext`

**例:**

```csharp
private Task WhoamiCommand(string _)
```

</details>

<details>

<summary>Power Commander</summary>

**コマンド:** `Get-KeeperInformation`

**別名:** `kwhoami`

**例:**

```powershell
PS > Get-KeeperInformation
User            : user@example.com
Server          : keepersecurity.com
Admin           : True
AccountType     : Enterprise
RenewalDate     : May 28, 2027
StorageCapacity : 1024
StorageUsage    : 0
StorageExpires  : May 28, 2027

LicenseType     : Enterprise
EnterpriseName  : Example
BasePlan        : Unknown
Expires         : 5/28/2027
StorageCapacity : 1TB
TotalUsers      : 20
ActiveUsers     : 6
InvitedUsers    : 0
```

</details>

<details>

<summary>Python CLI</summary>

**コマンド:** `whoami`

**フラグ** :

* `-h, --help` : ヘルプを表示して終了する
* `-v, --verbose` : 詳細出力

**例:**

```bash
My Vault> whoami -v
              User  user@example.com
            Server  keepersecurity.com
       Data Center  US
             Admin  True
      Account Type  Enterprise
      Renewal Date  May 28, 2027
       BreachWatch  True
Reporting & Alerts  True
           Records  11
    Shared Folders  11
             Teams  11
```

</details>

<details>

<summary>Python SDK</summary>

**関数:** 非対応

</details>

### マスターパスワード表示の取得・設定コマンド

現在認証済みのユーザーについて、ユーザー名とメールを含む情報を表示します。

<details>

<summary>DotNet CLI</summary>

未実装

</details>

<details>

<summary>DotNet SDK</summary>

未実装

</details>

<details>

<summary>Power Commander</summary>

**コマンド:** `Get-KeeperPasswordVisible`

現在のパスワード表示設定 (True または False) を返す。

**例:**

```powershell
PS > Get-KeeperPasswordVisible
True

PS > Get-KeeperPasswordVisible
False
```

**コマンド:** `Set-KeeperPasswordVisible`

レコード表示時にパスワードを平文で示すかマスクするかを切り替える。

**フラグ**: `-Visible` — 指定するとパスワードを平文で表示する。省略するとマスクする。

**例:**

```powershell
PS > Set-KeeperPasswordVisible -Visible
PS > Get-KeeperRecord "MyRecord"   # password fields shown in plaintext

PS > Set-KeeperPasswordVisible
PS > Get-KeeperRecord "MyRecord"   # password fields shown as ••••••
```

</details>

<details>

<summary>Python CLI</summary>

未実装

</details>

<details>

<summary>Python SDK</summary>

未実装

</details>

### 二要素認証コード表示コマンド

現在認証済みのユーザーについて、ユーザー名とメールを含む情報を表示します。

<details>

<summary>DotNet CLI</summary>

未実装

</details>

<details>

<summary>DotNet SDK</summary>

未実装

</details>

<details>

<summary>Power Commander</summary>

**コマンド:** `Show-TwoFactorCode`

**説明:** oneTimeCodeフィールドを持つレコードのTOTPコードを生成して表示する。コード、経過秒、残り秒を示す。

**フラグ**: `-Records` — レコードUIDまたはオブジェクト (必須、パイプライン)

**例:**

```powershell
PS > Show-TwoFactorCode -Records "recordUid123"

PS > Get-KeeperRecord -Uid "abcDEF123" | 2fa
```

**コマンド:** `Set-KeeperPasswordVisible`

レコード表示時にパスワードを平文で示すかマスクするかを切り替える。

**フラグ**: `-Visible` — 指定するとパスワードを平文で表示する。省略するとマスクする。

**例:**

```powershell
PS > Set-KeeperPasswordVisible -Visible
PS > Get-KeeperRecord "MyRecord"   # password fields shown in plaintext

PS > Set-KeeperPasswordVisible
PS > Get-KeeperRecord "MyRecord"   # password fields shown as ••••••
```

</details>

<details>

<summary>Python CLI</summary>

未実装

</details>

<details>

<summary>Python SDK</summary>

未実装

</details>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.keeper.io/keeperpam/jp/commander-sdk/keeper-commander-sdks/sdk-command-reference/login-commands.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
