Skip to content

Commit

Permalink
Improve Docs
Browse files Browse the repository at this point in the history
  • Loading branch information
maennchen committed Sep 17, 2023
1 parent 9a33ec7 commit f382585
Show file tree
Hide file tree
Showing 24 changed files with 101 additions and 3 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<img align="right" src="https://raw.githubusercontent.com/erlef/oidcc/main/assets/logo.svg" width="150px">

# oidcc

[![EEF Security WG project](https://img.shields.io/badge/EEF-Security-black)](https://github.com/erlef/security-wg)
Expand All @@ -14,11 +16,12 @@ OpenID Connect client library for Erlang.
<!--
OpenID Certified by Jonatan Männchen at the Erlang Ecosystem Foundation for the
basic and configuration profile of the OpenID Connect protocol. For details,
check the [Conformance Documentation] (./conformance/HOWTO.md).
check the [Conformance Documentation](https://github.com/erlef/oidcc/blob/main/conformance/HOWTO.md).
![OpenID Connect Certified Logo](https://openid.net/wp-content/uploads/2023/01/image.png))
![OpenID Connect Certified Logo](https://raw.githubusercontent.com/erlef/oidcc/main/assets/certified.svg)
-->


The refactoring for `v3` and the certification is funded as an
[Erlang Ecosystem Foundation](https://erlef.org/) stipend entered by the
[Security Working Group](https://erlef.org/wg/security).
Expand Down
1 change: 1 addition & 0 deletions assets/certified.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions assets/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions lib/oidcc.ex
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ defmodule Oidcc do
* `max_clock_skew` (default `0`) - Maximum allowed clock skew for JWT
`exp` / `nbf` validation
"""
@moduledoc since: "3.0.0"

@doc """
Create Auth Redirect URL
Expand All @@ -41,6 +42,7 @@ defmodule Oidcc do
...> )
"""
@doc since: "3.0.0"
@spec create_redirect_url(
provider_configuration_name :: GenServer.name(),
client_id :: String.t(),
Expand Down Expand Up @@ -79,6 +81,7 @@ defmodule Oidcc do
...> # => {:ok, %Oidcc.Token{}}
"""
@doc since: "3.0.0"
@spec retrieve_token(
auth_code :: String.t(),
provider_configuration_name :: GenServer.name(),
Expand Down Expand Up @@ -121,6 +124,7 @@ defmodule Oidcc do
...> # => {:ok, %Oidcc.Token{}}
"""
@doc since: "3.0.0"
@spec refresh_token(
refresh_token :: String.t(),
provider_configuration_name :: GenServer.name(),
Expand Down Expand Up @@ -172,6 +176,7 @@ defmodule Oidcc do
...> # => {:ok, %Oidcc.TokenIntrospection{}}
"""
@doc since: "3.0.0"
@spec introspect_token(
access_token :: String.t() | Oidcc.Token.t(),
provider_configuration_name :: GenServer.name(),
Expand Down Expand Up @@ -229,6 +234,7 @@ defmodule Oidcc do
...> # => {:ok, %{"sub" => "sub"}}
"""
@doc since: "3.0.0"
@spec retrieve_userinfo(
token :: Oidcc.Token.t(),
provider_configuration_name :: GenServer.name(),
Expand Down Expand Up @@ -284,6 +290,7 @@ defmodule Oidcc do
...> )
"""
@doc since: "3.0.0"
@spec jwt_profile_token(
subject :: String.t(),
provider_configuration_name :: GenServer.name(),
Expand Down Expand Up @@ -328,6 +335,7 @@ defmodule Oidcc do
...> )
"""
@doc since: "3.0.0"
@spec client_credentials_token(
provider_configuration_name :: GenServer.name(),
client_id :: String.t(),
Expand Down
2 changes: 2 additions & 0 deletions lib/oidcc/authorization.ex
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ defmodule Oidcc.Authorization do
@moduledoc """
Functions to start an OpenID Connect Authorization
"""
@moduledoc since: "3.0.0"

alias Oidcc.ClientContext

Expand Down Expand Up @@ -31,6 +32,7 @@ defmodule Oidcc.Authorization do
...> %{redirect_uri: "https://my.server/return"}
...> )
"""
@doc since: "3.0.0"
@spec create_redirect_url(
client_context :: ClientContext.t(),
opts :: :oidcc_authorization.opts()
Expand Down
4 changes: 4 additions & 0 deletions lib/oidcc/client_context.ex
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ defmodule Oidcc.ClientContext do
interface of `Oidcc`. In that case direct usage of this
module is not needed.
"""
@moduledoc since: "3.0.0"

use Oidcc.RecordStruct,
internal_name: :context,
Expand All @@ -15,6 +16,7 @@ defmodule Oidcc.ClientContext do

alias Oidcc.ProviderConfiguration

@typedoc since: "3.0.0"
@type t() :: %__MODULE__{
provider_configuration: ProviderConfiguration.t(),
jwks: JOSE.JWK.t(),
Expand Down Expand Up @@ -47,6 +49,7 @@ defmodule Oidcc.ClientContext do
...> "client_Secret"
...> )
"""
@doc since: "3.0.0"
@spec from_configuration_worker(
provider_name :: GenServer.name(),
client_id :: String.t(),
Expand Down Expand Up @@ -86,6 +89,7 @@ defmodule Oidcc.ClientContext do
...> "client_Secret"
...> )
"""
@doc since: "3.0.0"
@spec from_manual(
configuration :: ProviderConfiguration.t(),
jwks :: JOSE.JWK.t(),
Expand Down
5 changes: 5 additions & 0 deletions lib/oidcc/provider_configuration.ex
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ defmodule Oidcc.ProviderConfiguration do
#{telemetry_docs()}
"""
@moduledoc since: "3.0.0"

use Oidcc.RecordStruct,
internal_name: :configuration,
Expand All @@ -63,6 +64,7 @@ defmodule Oidcc.ProviderConfiguration do
* https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderMetadata
* https://datatracker.ietf.org/doc/html/draft-jones-oauth-discovery-01#section-4.1
"""
@typedoc since: "3.0.0"
@type t() :: %__MODULE__{
issuer: :uri_string.uri_string(),
authorization_endpoint: :uri_string.uri_string(),
Expand Down Expand Up @@ -119,6 +121,7 @@ defmodule Oidcc.ProviderConfiguration do
...> _expiry
...> }} = Oidcc.ProviderConfiguration.load_configuration("https://accounts.google.com")
"""
@doc since: "3.0.0"
@spec load_configuration(
issuer :: :uri_string.uri_string(),
opts :: :oidcc_provider_configuration.opts()
Expand All @@ -140,6 +143,7 @@ defmodule Oidcc.ProviderConfiguration do
iex> {:ok, {%JOSE.JWK{}, _expiry}} =
...> Oidcc.ProviderConfiguration.load_jwks("https://www.googleapis.com/oauth2/v3/certs")
"""
@doc since: "3.0.0"
@spec load_jwks(
jwks_uri :: :uri_string.uri_string(),
opts :: :oidcc_provider_configuration.opts()
Expand All @@ -166,6 +170,7 @@ defmodule Oidcc.ProviderConfiguration do
...> {:ok, %ProviderConfiguration{issuer: "https://accounts.google.com"}} =
...> Oidcc.ProviderConfiguration.decode_configuration(decoded_json)
"""
@doc since: "3.0.0"
@spec decode_configuration(configuration :: map()) ::
{:ok, t()} | {:error, :oidcc_provider_configuration.error()}
def decode_configuration(configuration) do
Expand Down
Loading

0 comments on commit f382585

Please sign in to comment.