Module: Contracts

Defined in:
lib/custom_contracts.rb

Defined Under Namespace

Classes: Algorithm, DecodedToken, DecodedTokenClaims, DecodedTokenHeader, EncodedToken, Key, RackRequestHttpAuth, RackResponse, ResourcePath, VerifierOptions

Constant Summary collapse

C =
Contracts
BEARER_TOKEN_REGEX =

The last segment gets dropped for ‘none’ algorithm since there is no signature so both of these patterns are valid. All character chunks are base64url format and periods.

Bearer abc123.abc123.abc123
Bearer abc123.abc123.
%r{
  ^Bearer\s{1}(       # starts with Bearer and a single space
  [a-zA-Z0-9\-\_]+\.  # 1 or more chars followed by a single period
  [a-zA-Z0-9\-\_]+\.  # 1 or more chars followed by a single period
  [a-zA-Z0-9\-\_]*    # 0 or more chars, no trailing chars
  )$
}x