Liking cljdoc? Tell your friends :D

ring-jwt-middleware.config


->configclj

(->config user-config)

Inputs: [user-config :- UserConfig] Returns: Config

Inputs: [user-config :- UserConfig]
Returns: Config
sourceraw docstring

conf-valid?clj

(conf-valid? {:keys [pubkey-path pubkey-fn] :as conf})
source

current-epoch!clj

(current-epoch!)

Inputs: [] Returns: s/Num

Returns the current time in epoch

Inputs: []
Returns: s/Num

Returns the current time in epoch
sourceraw docstring

default-configclj

source

default-error-handlerclj

(default-error-handler {:keys [error error_description] :as jwt-error})

Return an unauthorized HTTP response and log the error along debug infos

Return an `unauthorized` HTTP response and log the error along debug infos
sourceraw docstring

default-jwt-lifetime-in-secclj

Default JWT lifetime is 24h

Default JWT lifetime is 24h
sourceraw docstring

jwt->oauth-idsclj

(jwt->oauth-ids prefix jwt)

Inputs: [prefix :- s/Str jwt :- JWTClaims]

can be used as post-jwt-format-fn

This is an example function that given a JWT whose claims looks like:

  • :sub
  • "<prefix>/scopes"
  • "<prefix>/org/id"
  • "<prefix>/oauth/client/id"

It is a generic format about what an access-token should provide:

  • user-id, client-id, scopes
  • org-id

mainly transform a list of <prefix>/foo/bar/baz value into a deep nested map. For example:

(sut/jwt->oauth-ids "http://example.com/claims" {:sub "user-id" "http://example.com/claims/scopes" ["scope1" "scope2"] "http://example.com/claims/user/id" "user-id" "http://example.com/claims/user/name" "John Doe" "http://example.com/claims/user/email" "john.doe@dev.null" "http://example.com/claims/user/idp/id" "iroh" "http://example.com/claims/user/idp/name" "Visibility" "http://example.com/claims/org/id" "org-id" "http://example.com/claims/org/name" "ACME Inc." "http://example.com/claims/oauth/client/id" "client-id" "http://example.com/claims/oauth/kind" "code"})

=> {:user {:idp {:name "Visibility" :id "iroh"}, :name "John Doe", :email "john.doe@dev.null", :id "user-id"} :oauth {:kind "code" :client {:id "client-id"}}, :org {:name "ACME Inc." :id "org-id"}, :scopes #{"scope1" "scope2"}}

Inputs: [prefix :- s/Str jwt :- JWTClaims]

can be used as post-jwt-format-fn

This is an example function that given a JWT whose claims looks like:

- :sub
- "<prefix>/scopes"
- "<prefix>/org/id"
- "<prefix>/oauth/client/id"

It is a generic format about what an access-token should provide:

- user-id, client-id, scopes
- org-id

mainly transform a list of <prefix>/foo/bar/baz value into a deep nested map.
For example:

(sut/jwt->oauth-ids
        "http://example.com/claims"
        {:sub "user-id"
         "http://example.com/claims/scopes" ["scope1" "scope2"]
         "http://example.com/claims/user/id" "user-id"
         "http://example.com/claims/user/name" "John Doe"
         "http://example.com/claims/user/email" "john.doe@dev.null"
         "http://example.com/claims/user/idp/id" "iroh"
         "http://example.com/claims/user/idp/name" "Visibility"
         "http://example.com/claims/org/id" "org-id"
         "http://example.com/claims/org/name" "ACME Inc."
         "http://example.com/claims/oauth/client/id" "client-id"
         "http://example.com/claims/oauth/kind" "code"})

=> {:user {:idp {:name "Visibility"
                 :id "iroh"},
           :name "John Doe",
           :email "john.doe@dev.null",
           :id "user-id"}
    :oauth {:kind "code"
            :client {:id "client-id"}},
    :org   {:name "ACME Inc."
            :id "org-id"},
    :scopes #{"scope1" "scope2"}}
sourceraw docstring

jwt->user-idclj

(jwt->user-id jwt)

Inputs: [jwt :- JWTClaims] Returns: s/Str

can be used as post-jwt-format-fn

Inputs: [jwt :- JWTClaims]
Returns: s/Str

can be used as post-jwt-format-fn
sourceraw docstring

no-revocation-strategyclj

The default function used for :is-revoked-fn configuration

The default function used for `:is-revoked-fn` configuration
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close