
# すべてのプロパティ

`spring_boot_starter_flutter_security` が `spring.flutter.security` の下で読むすべてのプロパティ、続いてアプリがログインに使う登録を記述する OAuth2 クライアントのキー (`spring.security.oauth2.client.*`)、そしてログインが従う他のスターターのキーです。

## 使う理由

ログインのほとんどは設定です。どのプロバイダーか、どのクライアントか、どのリダイレクトか、そしてブラウザーでは誰がログインするかです。これらのキーはプラットフォームごとに異なる (スマートフォンではリダイレクトのスキーム、デスクトップではループバック、spa モードではページ) ので、通常はプロファイルのファイルに置きます。このページはそれらを一か所に列挙します。

## 例

```yaml
# lib/resources/application.yml: スマートフォンとデスクトップ
spring:
  security:
    oauth2:
      client:
        registration:
          keycloak:
            client-id: neon-app
            scope: openid,profile,email
            redirect-uri: dev.neon.books:/oauth2/callback
            dpop: auto
        provider:
          keycloak:
            issuer-uri: https://id.neon.books/realms/neon
  flutter:
    navigation:
      login: /login
```

```yaml
# lib/resources/application-desktop.yml
spring:
  security:
    oauth2:
      client:
        registration:
          keycloak:
            redirect-uri: http://127.0.0.1/callback
  flutter:
    security:
      application-id: NEON\Books
```

```yaml
# lib/resources/application-ios.yml
spring:
  flutter:
    security:
      ephemeral-session: false
```

```yaml
# lib/resources/application-web.yml: サーバーがログインする
spring:
  flutter:
    security:
      web:
        mode: server
        server-url: https://api.neon.books
        user-endpoint: /api/me
        logout-url: /api/logout
        authorization-base-uri: /oauth2/authorization
```

## spring.flutter.security

| キー | 型 | デフォルト | 意味 | ページ |
|---|---|---|---|---|
| `spring.flutter.security.ephemeral-session` | bool | `false` | iOS と macOS: ログインウィンドウ (`ASWebAuthenticationSession`) は Safari の Cookie を保持しない。ウィンドウの前のシステムのプロンプトはなくなるが、シングルサインオンもなくなる。Android は無視する | [トークンとログインウィンドウ](tokens-and-login-window.md) |
| `spring.flutter.security.application-id` | テキスト | アプリ自身の ID | Windows と Linux: アプリの秘密情報が保持される名前 (Windows: `%LOCALAPPDATA%\spring_secret_store` の下のフォルダー。`\` はフォルダーを区切る。Linux: Secret Service の項目の `application` 属性)。デフォルトはランナーの `<CompanyName>\<ProductName>` (Windows) または GTK のアプリケーション ID (Linux)、なければ実行ファイルの名前。空の値はデフォルト | [トークンとログインウィンドウ](tokens-and-login-window.md) |

## spring.flutter.security.web

ブラウザーでだけ読まれます (`web` プラットフォームのプロファイル)。不正な値は、キーの名前とともに起動時にアプリを止めます。

| キー | 型 | デフォルト | 意味 | ページ |
|---|---|---|---|---|
| `spring.flutter.security.web.mode` | `server`、`spa` | `server` | 誰がログインするか: アプリのサーバー (Backend for Frontend)、またはブラウザー自身 (PKCE を使うパブリッククライアント、タブのメモリーのトークン、取り出せない WebCrypto の鍵による DPoP。登録がなければアプリは起動時に止まる) | [サーバー](web-server-mode.md)、[spa](web-spa-mode.md) |
| `spring.flutter.security.web.server-url` | 絶対 `http(s)` URL、クエリなし | ページのオリジン | アプリのサーバー。あればそのコンテキストパスも含む。別のオリジンにある場合、それへのリクエストは Cookie を持ち (`FetchCredentials.include`)、サーバーはそれを許可しなければならない (クレデンシャル付きの CORS) | [サーバー](web-server-mode.md) |
| `spring.flutter.security.web.user-endpoint` | パスまたは絶対 URL | `/user` | セッション Cookie 付きの `GET`: 誰がログインしているか。`{"name", "authorities", "registrationId", "attributes"}` (`name` だけが必須) | [サーバー](web-server-mode.md#ユーザーのエンドポイント) |
| `spring.flutter.security.web.logout-url` | パスまたは絶対 URL | `/logout` | CSRF トークン付きの `POST`。応答 `{"logoutUrl": "..."}` または `Location` 付きの `2xx` は、ページをプロバイダーのログアウトに送る | [サーバー](web-server-mode.md#ログアウトの応答) |
| `spring.flutter.security.web.authorization-base-uri` | パスまたは絶対 URL | `/oauth2/authorization` | サーバーがログインを始める場所。`login('keycloak')` は `<server-url><this>/keycloak` へ行く | [サーバー](web-server-mode.md) |
| `spring.flutter.security.web.silent-restore` | bool | `true` | spa モード: リロードの後や新しいタブで、以前このブラウザーで誰かがログインしていれば、`restore()` は `prompt=none` でページをプロバイダーに送る | [spa](web-spa-mode.md#リロードの後-サイレントログイン) |

## 登録: spring.security.oauth2.client.registration

OAuth2 クライアント (`spring_boot_starter_oauth2_client`、このパッケージが持ち込む) の登録です。スマートフォン、デスクトップ、spa モードではアプリ自身のもので、サーバーモードではサーバーのもので、アプリは持ちません。

| キー | 型 | デフォルト | 意味 |
|---|---|---|---|
| `client-id` | テキスト | 必須 | プロバイダーでのクライアントの ID |
| `client-secret` | テキスト | なし | アプリにはなし: 省略すると、登録はパブリッククライアントになる。Google のデスクトップのクライアントは、秘密ではないシークレットを与える。spa モードでは拒否される |
| `client-authentication-method` | `client_secret_basic`、`client_secret_post`、`none` | シークレットがなければ `none`、あれば `client_secret_basic` | トークンエンドポイントでクライアントが誰であるかを証明する方法 |
| `authorization-grant-type` | `authorization_code`、`client_credentials` | `issuer-uri` または既知のプロバイダーがあれば `authorization_code` | ユーザーのログイン、またはクライアント自身のトークン |
| `redirect-uri` | URI またはテンプレート | なし | プロバイダーがブラウザーを送り返す場所: `neonbooks:/oauth2/callback` (スマートフォン)、`http://127.0.0.1/callback` (デスクトップ)、`{baseUrl}/` (spa モード) |
| `scope` | カンマ区切りのリストまたは YAML のリスト | 既知のプロバイダーではプロバイダーのデフォルト | 求めるスコープ。`openid` で OpenID Connect のログインになる |
| `client-name` | テキスト | issuer、または既知のプロバイダーの名前 | `OAuth2LoginButton` の名前 |
| `provider` | テキスト | 登録の ID | `provider.*` キーのプロバイダー、または既知のもの (`google`、`github`、`facebook`、`okta`、`apple`) |
| `dpop` | `auto`、`true`、`false` | `auto` | アプリの `DPoPKey` に結び付けられたトークン ([DPoP](dpop.md) を参照) |
| `native-sign-in` | `none`、`apple` | `apple` プロバイダーでは `apple`、それ以外は `none` | `apple`: iOS と macOS での Sign in with Apple のシート ([プロバイダー](providers.md) を参照) |
| `response-mode` | `query`、`form_post` | `query` | プロバイダーが応答を返す方法。アプリが受け取れるのは `query` だけ |
| `client-secret-jwt.*` | | | JWT として署名されたクライアントシークレット (Apple のもの)。アプリではなくサーバー向け |

各キーは `spring.security.oauth2.client.registration.<id>.<key>` と書きます。

## プロバイダー: spring.security.oauth2.client.provider

| キー | 型 | デフォルト | 意味 |
|---|---|---|---|
| `issuer-uri` | URL | なし | プロバイダー。その他のエンドポイントはその OpenID (または OAuth 2.0) のメタデータから来て、その `issuer` はこれと等しくなければならない |
| `authorization-uri` | URL | メタデータから | プロバイダーのログインページ |
| `token-uri` | URL | メタデータから | トークンエンドポイント (Apple では: アプリのサーバー) |
| `user-info-uri` | URL | メタデータから | ユーザー情報のエンドポイント |
| `user-info-authentication-method` | `header`、`form`、`query` | `header` | ユーザー情報のエンドポイントにアクセストークンを送る方法 |
| `user-name-attribute` | テキスト | `issuer-uri` では `sub` | ユーザーを名指す属性 |
| `jwk-set-uri` | URL | メタデータから | プロバイダーの公開鍵 (Sign in with Apple の ID トークンはそれでチェックされる) |

## 他のスターターのキー

| キー | スターター | 意味 |
|---|---|---|
| `spring.flutter.navigation.login` | ナビゲーション | ガードされた画面が、ログインしていない人を送る場所 ([ガードされた画面](guarded-screens.md) を参照) |
| `spring.flutter.web.dev-server.content-security-policy`、`-report-only`、`-connect-src` | Flutter | `flutter run` の Content Security Policy。spa モードは既製のものを受け取る ([spa モード](web-spa-mode.md#content-security-policy) を参照) |
| `spring.flutter.web.dev-server.proxy[n].*` | Flutter | 開発中のページと API のための一つのオリジン ([サーバーモード](web-server-mode.md#サーバー側) を参照) |
| `spring.feign.oauth2.enabled`、`spring.feign.oauth2.client-registration-id` | OAuth2 クライアント | Feign クライアントがアクセストークンを送るかどうか、そしてどの登録のものか |

## 関連項目

- [概要](index.md)
- [spring_boot_starter_flutter のすべてのプロパティ](../spring-boot-starter-flutter/properties.md)
- [spring_boot_starter_security](../spring-boot-starter-security/index.md)
