Add openid discovery endpoint

It has a few fake fields, that I will implement later.
This commit is contained in:
Ivan R. 2024-10-16 18:39:36 +05:00
parent 4490cd6a04
commit 42fa7c495f
Signed by: lumin
GPG key ID: E0937DC7CD6D3817
3 changed files with 19 additions and 0 deletions

View file

@ -108,6 +108,10 @@ defmodule ComfycampWeb.OauthController do
) )
end end
def openid_discovery(conn, _params) do
render(conn, :openid_discovery)
end
defp build_redirect_uri(redirect_uri, code, state) do defp build_redirect_uri(redirect_uri, code, state) do
parsed_uri = URI.parse(redirect_uri) parsed_uri = URI.parse(redirect_uri)

View file

@ -7,4 +7,18 @@ defmodule ComfycampWeb.OauthJSON do
id_token: id_token id_token: id_token
} }
end end
def openid_discovery(_assigns) do
%{
issuer: "https://comfycamp.space",
authorization_endpoint: "https://comfycamp.space/oauth/authorize",
token_endpoint: "https://comfycamp.space/oauth/token",
userinfo_endpoint: "https://comfycamp.space/oauth/userinfo",
jwks_uri: "https://comfycamp.space/.well-known/jwks.json",
response_types_supported: ["code"],
id_token_signing_alg_values_supported: ["HS256"],
scopes_supported: ["openid", "profile", "email"],
claims_supported: ["sub", "email", "preferred_username"]
}
end
end end

View file

@ -32,6 +32,7 @@ defmodule ComfycampWeb.Router do
pipe_through :api pipe_through :api
post "/oauth/token", OauthController, :token post "/oauth/token", OauthController, :token
get "/oauth/discovery", OauthController, :openid_discovery
end end
# Enable LiveDashboard and Swoosh mailbox preview in development # Enable LiveDashboard and Swoosh mailbox preview in development