
# All properties

Every property `spring_boot_starter_flutter_security` reads, under `spring.flutter.security`, then the keys of the OAuth2 client (`spring.security.oauth2.client.*`) that describe the registrations an app logs in with, and the keys of other starters the login follows.

## Why

A login is mostly configuration: which provider, which client, which redirect, and in a browser who logs in. These keys differ per platform (a redirect scheme on phones, a loopback on desktops, the page in spa mode), so they usually live in profile files. This page lists them in one place.

## Example

```yaml
# lib/resources/application.yml: phones and desktops
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: the server logs in
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

| Key | Type | Default | Meaning | Page |
|---|---|---|---|---|
| `spring.flutter.security.ephemeral-session` | bool | `false` | iOS and macOS: the login window (`ASWebAuthenticationSession`) keeps no cookies of Safari: no system prompt before the window, but no single sign-on. Android ignores it | [Tokens and the login window](tokens-and-login-window.md) |
| `spring.flutter.security.application-id` | text | the app's own id | Windows and Linux: the name the app's secrets are kept under (Windows: the folder under `%LOCALAPPDATA%\spring_secret_store`, `\` separates folders; Linux: the Secret Service items' `application` attribute). By default the runner's `<CompanyName>\<ProductName>` (Windows) or GTK application id (Linux), else the executable's name; a blank value is the default | [Tokens and the login window](tokens-and-login-window.md) |

## spring.flutter.security.web

Read in a browser only (the `web` platform profile). An invalid value stops the app at startup with the key's name.

| Key | Type | Default | Meaning | Page |
|---|---|---|---|---|
| `spring.flutter.security.web.mode` | `server`, `spa` | `server` | Who logs in: the app's server (backend-for-frontend), or the browser by itself (a public client with PKCE, tokens in the tab's memory, DPoP with a non-extractable WebCrypto key; without a registration the app stops at startup) | [Server](web-server-mode.md), [Spa](web-spa-mode.md) |
| `spring.flutter.security.web.server-url` | absolute `http(s)` URL, no query | the page's origin | The app's server, with its context path if any. On another origin, requests to it carry the cookies (`FetchCredentials.include`), and the server must allow it (CORS with credentials) | [Server](web-server-mode.md) |
| `spring.flutter.security.web.user-endpoint` | path or absolute URL | `/user` | `GET` with the session cookie: who is logged in, as `{"name", "authorities", "registrationId", "attributes"}` (only `name` required) | [Server](web-server-mode.md#the-user-endpoint) |
| `spring.flutter.security.web.logout-url` | path or absolute URL | `/logout` | `POST` with the CSRF token; an answer `{"logoutUrl": "..."}` or a `2xx` with `Location` sends the page to the provider's logout | [Server](web-server-mode.md#the-logout-answer) |
| `spring.flutter.security.web.authorization-base-uri` | path or absolute URL | `/oauth2/authorization` | Where the server starts a login; `login('keycloak')` goes to `<server-url><this>/keycloak` | [Server](web-server-mode.md) |
| `spring.flutter.security.web.silent-restore` | bool | `true` | Spa mode: after a reload or in a new tab, `restore()` sends the page to the provider with `prompt=none` when someone logged in in this browser before | [Spa](web-spa-mode.md#after-a-reload-the-silent-login) |

## Registrations: spring.security.oauth2.client.registration

The registrations of the OAuth2 client (`spring_boot_starter_oauth2_client`, brought by this package). On phones, desktops and in spa mode they are the app's own; in server mode they are the server's, and the app has none.

| Key | Type | Default | Meaning |
|---|---|---|---|
| `client-id` | text | required | The client's id at the provider |
| `client-secret` | text | none | None for an app: leave it out, the registration is then a public client. Google's desktop clients give one that is no secret. Refused in spa mode |
| `client-authentication-method` | `client_secret_basic`, `client_secret_post`, `none` | `none` without a secret, else `client_secret_basic` | How the client proves who it is at the token endpoint |
| `authorization-grant-type` | `authorization_code`, `client_credentials` | `authorization_code` with an `issuer-uri` or a known provider | A user's login, or the client's own tokens |
| `redirect-uri` | URI or template | none | Where the provider sends the browser back: `neonbooks:/oauth2/callback` (phones), `http://127.0.0.1/callback` (desktops), `{baseUrl}/` (spa mode) |
| `scope` | comma list or YAML list | the provider's defaults for known providers | The scopes asked for; `openid` makes it an OpenID Connect login |
| `client-name` | text | the issuer, or the known provider's name | The name on `OAuth2LoginButton` |
| `provider` | text | the registration's id | The provider of the `provider.*` keys, or a known one (`google`, `github`, `facebook`, `okta`, `apple`) |
| `dpop` | `auto`, `true`, `false` | `auto` | Tokens bound to the app's `DPoPKey` (see [DPoP](dpop.md)) |
| `native-sign-in` | `none`, `apple` | `apple` for the `apple` provider, else `none` | `apple`: Sign in with Apple's sheet on iOS and macOS (see [Providers](providers.md)) |
| `response-mode` | `query`, `form_post` | `query` | How the provider returns its answer; an app can only receive `query` |
| `client-secret-jwt.*` | | | A client secret signed as a JWT (Apple's); for servers, not apps |

Each key is written `spring.security.oauth2.client.registration.<id>.<key>`.

## Providers: spring.security.oauth2.client.provider

| Key | Type | Default | Meaning |
|---|---|---|---|
| `issuer-uri` | URL | none | The provider; the other endpoints come from its OpenID (or OAuth 2.0) metadata, whose `issuer` must equal it |
| `authorization-uri` | URL | from the metadata | The provider's login page |
| `token-uri` | URL | from the metadata | The token endpoint (for Apple: the app's server) |
| `user-info-uri` | URL | from the metadata | The user-info endpoint |
| `user-info-authentication-method` | `header`, `form`, `query` | `header` | How the access token is sent to the user-info endpoint |
| `user-name-attribute` | text | `sub` with `issuer-uri` | The attribute that names the user |
| `jwk-set-uri` | URL | from the metadata | The provider's public keys (Sign in with Apple's identity token is checked with them) |

## Keys of other starters

| Key | Starter | Meaning |
|---|---|---|
| `spring.flutter.navigation.login` | navigation | Where a guarded screen sends nobody logged in (see [Guarded screens](guarded-screens.md)) |
| `spring.flutter.web.dev-server.content-security-policy`, `-report-only`, `-connect-src` | Flutter | The Content Security Policy of `flutter run`; spa mode gets a ready one (see [Spa mode](web-spa-mode.md#the-content-security-policy)) |
| `spring.flutter.web.dev-server.proxy[n].*` | Flutter | One origin for the page and the API in development (see [Server mode](web-server-mode.md#the-servers-side)) |
| `spring.feign.oauth2.enabled`, `spring.feign.oauth2.client-registration-id` | OAuth2 client | Whether Feign clients send the access token, and of which registration |

## See also

- [Overview](index.md)
- [All properties of spring_boot_starter_flutter](../spring-boot-starter-flutter/properties.md)
- [spring_boot_starter_security](../spring-boot-starter-security/index.md)
