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)
pub type ParseError {
ParseError(error: json.DecodeError)
UnsupportedContent(content_type: String)
}
Constructors
-
ParseError(error: json.DecodeError)If the response does not contain valid JSON or does not conform to the error response format defined by RFC6749 Error Response this error will be returned.
-
UnsupportedContent(content_type: String)If the response does not match the required content type such as application/json
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 json_attach_list_member(
entries: List(#(String, json.Json)),
name: String,
values: List(a),
to_json: fn(a) -> json.Json,
) -> List(#(String, json.Json))
pub fn json_attach_member(
entries: List(#(String, json.Json)),
name: String,
value: option.Option(a),
to_json: fn(a) -> json.Json,
) -> List(#(String, json.Json))
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.
pub fn timestamp_decoder() -> decode.Decoder(timestamp.Timestamp)
pub fn uri_decoder(raw_uri: String) -> decode.Decoder(uri.Uri)