flwr_oauth2/common

Types

Type to indicate the client ID. Mostly used to have type-safe parameters, so client id, client secret, etc are not mixed up. See RFC6749

pub type ClientId {
  ClientId(value: String)
}

Constructors

  • ClientId(value: String)

Type alias for the scope. A scope is a list of strings. See RFC6749

pub type Scope =
  List(String)

Type to indicate the client secret. Mostly used to have type-safe parameters, so client id, client secret, etc are not mixed up. See RFC6749

pub type Secret {
  Secret(value: String)
  SecretWithExpiration(
    value: String,
    expires_at: timestamp.Timestamp,
  )
}

Constructors

  • Secret(value: String)

    A normal OAuth 2.0 client secret

  • SecretWithExpiration(
      value: String,
      expires_at: timestamp.Timestamp,
    )

    A client secret with an expiration date attached. Can be used to check if the secret expired.

Values

pub fn is_secret_invalid(secret: Secret) -> Bool

Checks if a given secret is expired. Returns always false for secrets that cannot expire.

pub fn parse_scope(scope: String) -> List(String)

Parses a string containing the space separated scopes.

Example

parse_scope("scope1 scope2")
pub fn secret_is_valid(secret: Secret) -> Bool

Checks if a given secret is not expired. Returns always true for secrets that cannot expire.

Search Document