# `MishkaCmsCore.Accounts.ProviderStrategy`
[🔗](https://github.com/mishka-group/mishka_cms_core/blob/v0.0.1/lib/mishka_cms_core/accounts/provider_strategy.ex#L5)

One AshAuthentication strategy for every sign-in provider, whichever the installed plugins are:
the core names none of them.

Modelled on AshAuthentication's own `dynamic_oidc`, with the provider coming from a
`mishka_installer` plugin (`MishkaCmsCore.Accounts.SignInProvider`) instead of a database row,
and any Assent provider rather than OpenID Connect alone. At a request,
`MishkaCmsCore.Accounts.ProviderStrategy.Plug` finds the plugin the path names, fills this
struct with its Assent strategy, Assent's own defaults for it and the site's keys, and hands it
to AshAuthentication's `OAuth2.Plug`, which does the sign-in. The provider's id is the
connection id, so each provider's identities are kept apart (`"provider/<id>"`).

    authentication do
      strategies do
        sign_in_providers :provider do
          identity_resource MishkaCmsCore.Accounts.UserIdentity
          register_action_name :register_with_provider
        end
      end
    end

Its routes, under the host's auth mount: `/user/provider/:provider/request` starts a sign-in, and
`/user/provider/callback` is where every provider sends the visitor back — the provider the sign-in
started with waits in the session, as `dynamic_oidc` keeps its connection.

# `t`

```elixir
@type t() :: %MishkaCmsCore.Accounts.ProviderStrategy{
  __connection_id__: term(),
  __spark_metadata__: term(),
  assent_strategy: term(),
  auth_method: term(),
  authorization_params: term(),
  authorize_url: term(),
  base_url: term(),
  client_authentication_method: term(),
  client_id: term(),
  client_secret: term(),
  code_verifier: term(),
  email_field: term(),
  icon: term(),
  id_token_signed_response_alg: term(),
  id_token_ttl_seconds: term(),
  identity_relationship_name: term(),
  identity_relationship_user_id_attribute: term(),
  identity_resource: term(),
  idp_initiated_login?: term(),
  name: term(),
  nonce: term(),
  on_untrusted_email_match: term(),
  openid_configuration: term(),
  openid_configuration_uri: term(),
  openid_default_scope: term(),
  prevent_hijacking?: term(),
  private_key: term(),
  private_key_id: term(),
  private_key_path: term(),
  provider: term(),
  redirect_uri: term(),
  register_action_name: term(),
  registration_enabled?: term(),
  resource: term(),
  session_identifier: term(),
  sign_in_action_name: term(),
  site: term(),
  strategy_module: term(),
  team_id: term(),
  token_url: term(),
  trust_email_verified?: term(),
  trusted_audiences: term(),
  user_url: term(),
  warn_on_missing_identity_resource?: term()
}
```

---

*Consult [api-reference.md](api-reference.md) for complete listing*
