class Virgil::Jwt::CallbackJwtProvider
provides an opportunity to get access token using callback mechanism.
Attributes
obtain_access_token_proc[R]
Callback, that takes an instance of [TokenContext] and returns string representation of generated instance of [AccessToken]
Public Class Methods
new(obtain_token_proc)
click to toggle source
# File lib/virgil/jwt/callback_jwt_provider.rb, line 45 def initialize(obtain_token_proc) Validation.check_type_argument!(Proc, obtain_token_proc) @obtain_access_token_proc = obtain_token_proc end
Public Instance Methods
get_token(token_context)
click to toggle source
Gets access token. @param token_context [TokenContext] @return [AccessToken] Access token
# File lib/virgil/jwt/callback_jwt_provider.rb, line 53 def get_token(token_context) Validation.check_type_argument!(TokenContext, token_context) jwt_str = @obtain_access_token_proc.call(token_context) Jwt.from(jwt_str) end