oauth/oidc

This commit is contained in:
bluepython508
2023-11-07 19:35:03 +00:00
parent a0fc306df1
commit 54db8727b0
20 changed files with 670 additions and 3 deletions

View File

@@ -0,0 +1,31 @@
defmodule SsoBsnWeb.Oauth.RevokeController do
@behaviour Boruta.Oauth.RevokeApplication
use SsoBsnWeb, :controller
alias Boruta.Oauth.Error
alias SsoBsnWeb.OauthView
def oauth_module, do: Application.get_env(:sso_bsn, :oauth_module, Boruta.Oauth)
def revoke(%Plug.Conn{} = conn, _params) do
conn |> oauth_module().revoke(__MODULE__)
end
@impl Boruta.Oauth.RevokeApplication
def revoke_success(%Plug.Conn{} = conn) do
send_resp(conn, 200, "")
end
@impl Boruta.Oauth.RevokeApplication
def revoke_error(conn, %Error{
status: status,
error: error,
error_description: error_description
}) do
conn
|> put_status(status)
|> put_view(OauthView)
|> json(%{error: error, error_description: error_description})
end
end