Class: Virgil::Jwt::TokenContext

Inherits:
Object
  • Object
show all
Defined in:
lib/virgil/jwt/token_context.rb

Overview

Provides payload for access token providers

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(operation:, identity:, service: nil, force_reload: false) ⇒ TokenContext

Initializes a new instance of the class If you set up token cache in CallbackJwtProvider#obtain_access_token_proc it should reset cached token and return new if TRUE.

Parameters:

  • operation (String)

    Operation for which token is needed

  • identity (String)

    Identity to use in token

  • force_reload (TrueClass) (defaults to: false)

    or [FalseClass]



64
65
66
67
68
69
# File 'lib/virgil/jwt/token_context.rb', line 64

def initialize(operation:, identity:, service: nil, force_reload: false)
  @operation = operation
  @identity = identity
  @service = service
  @force_reload = force_reload
end

Instance Attribute Details

#force_reloadTrueClass (readonly)

You can set up token cache in CallbackJwtProvider#obtain_access_token_proc and reset cached token if True.

Returns:

  • (TrueClass)

    or [FalseClass]



56
57
58
# File 'lib/virgil/jwt/token_context.rb', line 56

def force_reload
  @force_reload
end

#identityString (readonly)

Identity that should be used in access token.

Returns:

  • (String)


47
48
49
# File 'lib/virgil/jwt/token_context.rb', line 47

def identity
  @identity
end

#operationString (readonly)

Operation for which token is needed.

Returns:

  • (String)


43
44
45
# File 'lib/virgil/jwt/token_context.rb', line 43

def operation
  @operation
end

#serviceString (readonly)

Service for which token is needed.

Returns:

  • (String)


51
52
53
# File 'lib/virgil/jwt/token_context.rb', line 51

def service
  @service
end