Skip to content

Commit

Permalink
chore(deps): Bump assent from 0.2.7 to 0.2.8 (#506)
Browse files Browse the repository at this point in the history
* chore(deps): Bump assent from 0.2.7 to 0.2.8

Bumps [assent](https://github.com/pow-auth/assent) from 0.2.7 to 0.2.8.
- [Release notes](https://github.com/pow-auth/assent/releases)
- [Changelog](https://github.com/pow-auth/assent/blob/main/CHANGELOG.md)
- [Commits](pow-auth/assent@v0.2.7...v0.2.8)

---
updated-dependencies:
- dependency-name: assent
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

* chore(OAuth2): Reflect `assent` `site` -> `base_url` change.

I considered just rewriting it behind the scenes, but I think it's probably better in the long run if we just emit a deprecation.

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: James Harton <[email protected]>
  • Loading branch information
dependabot[bot] and jimsynz authored Nov 21, 2023
1 parent f4df603 commit 408a28c
Show file tree
Hide file tree
Showing 16 changed files with 349 additions and 222 deletions.
1 change: 1 addition & 0 deletions .formatter.exs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ spark_locals_without_parens = [
auth_method: 1,
authorization_params: 1,
authorize_url: 1,
base_url: 1,
client_authentication_method: 1,
client_id: 1,
client_secret: 1,
Expand Down
6 changes: 3 additions & 3 deletions config/dev.exs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ config :ash_authentication,
client_id: System.get_env("OAUTH2_CLIENT_ID"),
redirect_uri: "http://localhost:4000/auth",
client_secret: System.get_env("OAUTH2_CLIENT_SECRET"),
site: System.get_env("OAUTH2_SITE"),
base_url: System.get_env("OAUTH2_SITE"),
authorize_url: "#{System.get_env("OAUTH2_SITE")}/authorize",
token_url: "#{System.get_env("OAUTH2_SITE")}/oauth/token",
user_url: "#{System.get_env("OAUTH2_SITE")}/userinfo"
Expand All @@ -40,7 +40,7 @@ config :ash_authentication,
client_id: System.get_env("OAUTH2_CLIENT_ID"),
redirect_uri: "http://localhost:4000/auth",
client_secret: System.get_env("OAUTH2_CLIENT_SECRET"),
site: System.get_env("OAUTH2_SITE")
base_url: System.get_env("OAUTH2_SITE")
],
github: [
client_id: System.get_env("GITHUB_CLIENT_ID"),
Expand All @@ -52,7 +52,7 @@ config :ash_authentication,
client_id: System.get_env("OAUTH2_CLIENT_ID"),
client_secret: System.get_env("OAUTH2_CLIENT_SECRET"),
redirect_uri: "http://localhost:4000/auth",
site: System.get_env("OAUTH2_SITE"),
base_url: System.get_env("OAUTH2_SITE"),
token_url: "#{System.get_env("OAUTH2_SITE")}/oauth/token"
]
],
Expand Down
2 changes: 1 addition & 1 deletion config/test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ config :ash_authentication,
client_id: "pretend client id",
redirect_uri: "http://localhost:4000/auth",
client_secret: "pretend client secret",
site: "https://example.com/",
base_url: "https://example.com/",
authorize_url: "https://example.com/authorize",
token_url: "https://example.com/oauth/token",
user_url: "https://example.com/userinfo"
Expand Down
103 changes: 62 additions & 41 deletions documentation/dsls/DSL:-AshAuthentication.Strategy.Auth0.cheatmd
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ The following defaults are applied:
end
```

* `:site` - Required. The base URL of the OAuth2 server - including the leading protocol
* `:base_url` - The base URL of the OAuth2 server - including the leading protocol
(ie `https://`).
Takes either a module which implements the `AshAuthentication.Secret`
behaviour, a 2 arity anonymous function or a string.
Expand All @@ -72,13 +72,15 @@ The following defaults are applied:

Example:
```elixir
site fn _, resource ->
base_url fn _, resource ->
:my_app
|> Application.get_env(resource, [])
|> Keyword.fetch(:oauth_site)
end
```

* `:site` - Deprecated: Use `base_url` instead.

* `:auth_method` - The authentication strategy used, optional. If not set, no
authentication will be used during the access token request. The
value may be one of the following:
Expand Down Expand Up @@ -331,9 +333,9 @@ end

<tr>
<td style="text-align: left">
<a id="authentication-strategies-auth0-site" href="#authentication-strategies-auth0-site">
<a id="authentication-strategies-auth0-authorize_url" href="#authentication-strategies-auth0-authorize_url">
<span style="font-family: Inconsolata, Menlo, Courier, monospace;">
site
authorize_url
</span>
</a>
<sup style="color: red">*</sup>
Expand All @@ -346,8 +348,9 @@ end

</td>
<td style="text-align: left" colspan=2>
The base URL of the OAuth2 server - including the leading protocol
(ie `https://`).
The API url to the OAuth2 authorize endpoint.

Relative to the value of `site`.

Takes either a module which implements the `AshAuthentication.Secret`
behaviour, a 2 arity anonymous function or a string.
Expand All @@ -359,21 +362,17 @@ information.
Example:

```elixir
site fn _, resource ->
:my_app
|> Application.get_env(resource, [])
|> Keyword.fetch(:oauth_site)
end
authorize_url fn _, _ -> {:ok, "https://exampe.com/authorize"} end
```

</td>
</tr>

<tr>
<td style="text-align: left">
<a id="authentication-strategies-auth0-authorize_url" href="#authentication-strategies-auth0-authorize_url">
<a id="authentication-strategies-auth0-token_url" href="#authentication-strategies-auth0-token_url">
<span style="font-family: Inconsolata, Menlo, Courier, monospace;">
authorize_url
token_url
</span>
</a>
<sup style="color: red">*</sup>
Expand All @@ -386,7 +385,7 @@ end

</td>
<td style="text-align: left" colspan=2>
The API url to the OAuth2 authorize endpoint.
The API url to access the token endpoint.

Relative to the value of `site`.

Expand All @@ -400,17 +399,17 @@ information.
Example:

```elixir
authorize_url fn _, _ -> {:ok, "https://exampe.com/authorize"} end
token_url fn _, _ -> {:ok, "https://example.com/oauth_token"} end
```

</td>
</tr>

<tr>
<td style="text-align: left">
<a id="authentication-strategies-auth0-token_url" href="#authentication-strategies-auth0-token_url">
<a id="authentication-strategies-auth0-user_url" href="#authentication-strategies-auth0-user_url">
<span style="font-family: Inconsolata, Menlo, Courier, monospace;">
token_url
user_url
</span>
</a>
<sup style="color: red">*</sup>
Expand All @@ -423,7 +422,7 @@ authorize_url fn _, _ -> {:ok, "https://exampe.com/authorize"} end

</td>
<td style="text-align: left" colspan=2>
The API url to access the token endpoint.
The API url to access the user endpoint.

Relative to the value of `site`.

Expand All @@ -437,17 +436,17 @@ information.
Example:

```elixir
token_url fn _, _ -> {:ok, "https://example.com/oauth_token"} end
user_url fn _, _ -> {:ok, "https://example.com/userinfo"} end
```

</td>
</tr>

<tr>
<td style="text-align: left">
<a id="authentication-strategies-auth0-user_url" href="#authentication-strategies-auth0-user_url">
<a id="authentication-strategies-auth0-redirect_uri" href="#authentication-strategies-auth0-redirect_uri">
<span style="font-family: Inconsolata, Menlo, Courier, monospace;">
user_url
redirect_uri
</span>
</a>
<sup style="color: red">*</sup>
Expand All @@ -460,9 +459,14 @@ token_url fn _, _ -> {:ok, "https://example.com/oauth_token"} end

</td>
<td style="text-align: left" colspan=2>
The API url to access the user endpoint.
The callback URI base.

Relative to the value of `site`.
Not the whole URI back to the callback endpoint, but the URI to your
`AuthPlug`. We can generate the rest.

Whilst not particularly secret, it seemed prudent to allow this to be
configured dynamically so that you can use different URIs for
different environments.

Takes either a module which implements the `AshAuthentication.Secret`
behaviour, a 2 arity anonymous function or a string.
Expand All @@ -471,24 +475,17 @@ See the module documentation for `AshAuthentication.Secret` for more
information.


Example:

```elixir
user_url fn _, _ -> {:ok, "https://example.com/userinfo"} end
```

</td>
</tr>

<tr>
<td style="text-align: left">
<a id="authentication-strategies-auth0-redirect_uri" href="#authentication-strategies-auth0-redirect_uri">
<a id="authentication-strategies-auth0-base_url" href="#authentication-strategies-auth0-base_url">
<span style="font-family: Inconsolata, Menlo, Courier, monospace;">
redirect_uri
base_url
</span>
</a>
<sup style="color: red">*</sup>


</td>
<td style="text-align: left">
<code class="inline">(any, any -> any) | module | String.t</code>
Expand All @@ -497,14 +494,8 @@ user_url fn _, _ -> {:ok, "https://example.com/userinfo"} end

</td>
<td style="text-align: left" colspan=2>
The callback URI base.

Not the whole URI back to the callback endpoint, but the URI to your
`AuthPlug`. We can generate the rest.

Whilst not particularly secret, it seemed prudent to allow this to be
configured dynamically so that you can use different URIs for
different environments.
The base URL of the OAuth2 server - including the leading protocol
(ie `https://`).

Takes either a module which implements the `AshAuthentication.Secret`
behaviour, a 2 arity anonymous function or a string.
Expand All @@ -513,6 +504,36 @@ See the module documentation for `AshAuthentication.Secret` for more
information.


Example:

```elixir
base_url fn _, resource ->
:my_app
|> Application.get_env(resource, [])
|> Keyword.fetch(:oauth_site)
end
```

</td>
</tr>

<tr>
<td style="text-align: left">
<a id="authentication-strategies-auth0-site" href="#authentication-strategies-auth0-site">
<span style="font-family: Inconsolata, Menlo, Courier, monospace;">
site
</span>
</a>

</td>
<td style="text-align: left">
<code class="inline">(any, any -> any) | module | String.t</code>
</td>
<td style="text-align: left">

</td>
<td style="text-align: left" colspan=2>
Deprecated: Use `base_url` instead.
</td>
</tr>

Expand Down
Loading

0 comments on commit 408a28c

Please sign in to comment.