-
-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement RP Initiated Logout (#258)
- Loading branch information
Showing
15 changed files
with
503 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
defmodule Oidcc.Logout do | ||
@moduledoc """ | ||
Logout from the OpenID Provider | ||
""" | ||
@moduledoc since: "3.0.0" | ||
|
||
alias Oidcc.ClientContext | ||
|
||
@doc """ | ||
Initiate URI for Relaying Party initated Logout | ||
See https://openid.net/specs/openid-connect-rpinitiated-1_0.html#RPLogout | ||
For a high level interface using `Oidcc.ProviderConfiguration.Worker` | ||
see `Oidcc.initiate_logout_url/5`. | ||
## Examples | ||
iex> {:ok, pid} = | ||
...> Oidcc.ProviderConfiguration.Worker.start_link(%{ | ||
...> issuer: "https://erlef-test-w4a8z2.zitadel.cloud" | ||
...> }) | ||
...> | ||
...> {:ok, client_context} = | ||
...> Oidcc.ClientContext.from_configuration_worker( | ||
...> pid, | ||
...> "client_id", | ||
...> "client_secret" | ||
...> ) | ||
...> | ||
...> # Get `token` from `Oidcc.retrieve_token/5` | ||
...> token = "token" | ||
...> | ||
...> {:ok, _redirect_uri} = | ||
...> Oidcc.Logout.initiate_url( | ||
...> token, | ||
...> client_context, | ||
...> %{post_logout_redirect_uri: "https://my.server/return"} | ||
...> ) | ||
""" | ||
@doc since: "3.0.0" | ||
@spec initiate_url( | ||
token :: id_token | Oidcc.Token.t() | :undefined, | ||
client_context :: ClientContext.t(), | ||
opts :: :oidcc_logout.initiate_url_opts() | ||
) :: | ||
{:ok, :uri_string.uri_string()} | ||
| {:error, :oidcc_logout.error()} | ||
when id_token: String.t() | ||
def initiate_url(token, client_context, opts \\ %{}) do | ||
client_context = ClientContext.struct_to_record(client_context) | ||
|
||
:oidcc_logout.initiate_url(token, client_context, opts) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.