Class: KeycloakAdmin::ImpersonationRepresentation
- Inherits:
-
Representation
- Object
- Representation
- KeycloakAdmin::ImpersonationRepresentation
- Defined in:
- lib/keycloak-admin/representation/impersonation_representation.rb
Instance Attribute Summary collapse
-
#domain ⇒ Object
Returns the value of attribute domain.
-
#redirect ⇒ Object
Returns the value of attribute redirect.
-
#same_realm ⇒ Object
Returns the value of attribute same_realm.
-
#set_cookie_strings ⇒ Object
Returns the value of attribute set_cookie_strings.
-
#set_cookies ⇒ Object
Returns the value of attribute set_cookies.
Class Method Summary collapse
- .from_response(response, origin) ⇒ Object
- .parse_set_cookie_string(set_cookie_string, origin) ⇒ Object
Instance Method Summary collapse
Methods inherited from Representation
Methods included from CamelJson
Instance Attribute Details
#domain ⇒ Object
Returns the value of attribute domain.
5 6 7 |
# File 'lib/keycloak-admin/representation/impersonation_representation.rb', line 5 def domain @domain end |
#redirect ⇒ Object
Returns the value of attribute redirect.
5 6 7 |
# File 'lib/keycloak-admin/representation/impersonation_representation.rb', line 5 def redirect @redirect end |
#same_realm ⇒ Object
Returns the value of attribute same_realm.
5 6 7 |
# File 'lib/keycloak-admin/representation/impersonation_representation.rb', line 5 def same_realm @same_realm end |
#set_cookie_strings ⇒ Object
Returns the value of attribute set_cookie_strings.
5 6 7 |
# File 'lib/keycloak-admin/representation/impersonation_representation.rb', line 5 def @set_cookie_strings end |
#set_cookies ⇒ Object
Returns the value of attribute set_cookies.
5 6 7 |
# File 'lib/keycloak-admin/representation/impersonation_representation.rb', line 5 def @set_cookies end |
Class Method Details
.from_response(response, origin) ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/keycloak-admin/representation/impersonation_representation.rb', line 11 def self.from_response(response, origin) body = JSON.parse(response.body) representation = new representation. = response.headers[:set_cookie] representation. = representation..map { || (, origin) } representation.same_realm = body["sameRealm"] representation.redirect = body["redirect"] representation.domain = origin representation end |
.parse_set_cookie_string(set_cookie_string, origin) ⇒ Object
22 23 24 |
# File 'lib/keycloak-admin/representation/impersonation_representation.rb', line 22 def self.(, origin) HTTP::Cookie.parse(, origin).first end |
Instance Method Details
#cookies_to_rails_hash ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/keycloak-admin/representation/impersonation_representation.rb', line 26 def @set_cookies.map do || = { name: .name, value: .value, httponly: .httponly, expires: .expires, path: .path, domain: .domain } [:max_age] = .max_age if .max_age [:secure] = .secure if .secure end end |