module Keycloak::UserEntity
Attributes
keycloak_token[RW]
Public Instance Methods
_set_or_get_keycloak_data(attr_name, reload) { || ... }
click to toggle source
# File lib/keycloak/user_entity.rb, line 30 def _set_or_get_keycloak_data(attr_name, reload) reload ? instance_variable_set(attr_name, yield) : instance_variable_get(attr_name) || instance_variable_set(attr_name, yield) end
has_role?(role)
click to toggle source
# File lib/keycloak/user_entity.rb, line 24 def has_role?(role) keycloak_token ? keycloak_token.has_role?(role) : realm_roles.map(&:name).include?(role) end
keycloak_client()
click to toggle source
# File lib/keycloak/user_entity.rb, line 8 def keycloak_client raise NotImplementedError end
keycloak_identify()
click to toggle source
# File lib/keycloak/user_entity.rb, line 12 def keycloak_identify id end
realm_roles(reload = false)
click to toggle source
# File lib/keycloak/user_entity.rb, line 20 def realm_roles(reload = false) _set_or_get_keycloak_data(:@realm_roles, reload) { keycloak_client.find_user_realm_roles(keycloak_identify) } end
user_info(reload = false)
click to toggle source
# File lib/keycloak/user_entity.rb, line 16 def user_info(reload = false) _set_or_get_keycloak_data(:@user_info, reload) { keycloak_client.find_user(keycloak_identify) } end