Class: Warden::Cognito::TestHelpers

Inherits:
Object
  • Object
show all
Defined in:
lib/warden/cognito/test_helpers.rb

Defined Under Namespace

Classes: EnvironmentError

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.jwkObject (readonly)

Returns the value of attribute jwk.



9
10
11
# File 'lib/warden/cognito/test_helpers.rb', line 9

def jwk
  @jwk
end

Class Method Details

.auth_headers(headers, user, pool_identifier = Warden::Cognito.config.user_pools.first.identifier, claims = {}) ⇒ Object



15
16
17
18
# File 'lib/warden/cognito/test_helpers.rb', line 15

def auth_headers(headers, user, pool_identifier = Warden::Cognito.config.user_pools.first.identifier,
                 claims = {})
  headers.merge(Authorization: "Bearer #{generate_token(user, pool_identifier, claims)}")
end

.local_issuerObject



20
21
22
# File 'lib/warden/cognito/test_helpers.rb', line 20

def local_issuer
  'local_issuer'
end

.setupObject



11
12
13
# File 'lib/warden/cognito/test_helpers.rb', line 11

def setup
  Warden::Cognito.config.jwk = { key: jwk, issuer: local_issuer }
end