Sha256: 2ae1f92457f067e31edc1aac5714c600d6cc4204dc7ad9055cddd4ed3d457004
Contents?: true
Size: 822 Bytes
Versions: 12
Compression:
Stored size: 822 Bytes
Contents
module KeycloakAdmin class ConfigurableTokenClient < Client def initialize(configuration, realm_client) super(configuration) raise ArgumentError.new("realm must be defined") unless realm_client.name_defined? @realm_client = realm_client end def token_url "#{realm_url}/configurable-token" end def realm_url @realm_client.realm_url end def exchange_with(user_access_token, token_lifespan_in_seconds) response = execute_http do RestClient.post(token_url, { tokenLifespanInSeconds: token_lifespan_in_seconds }.to_json, { Authorization: "Bearer #{user_access_token}", content_type: :json, accept: :json }) end TokenRepresentation.from_json(response.body) end end end
Version data entries
12 entries across 12 versions & 1 rubygems