Module: Zaikio::JWTAuth::ClassMethods

Defined in:
lib/zaikio/jwt_auth.rb

Instance Method Summary collapse

Instance Method Details

#authorize_by_jwt_scopes(scopes = nil, options = {}) ⇒ Object



101
102
103
104
105
106
107
# File 'lib/zaikio/jwt_auth.rb', line 101

def authorize_by_jwt_scopes(scopes = nil, options = {})
  @authorize_by_jwt_scopes ||= []

  @authorize_by_jwt_scopes << options.merge(scopes: scopes) if scopes

  @authorize_by_jwt_scopes
end

#authorize_by_jwt_subject_type(type = :_not_given_) ⇒ Object



93
94
95
96
97
98
99
# File 'lib/zaikio/jwt_auth.rb', line 93

def authorize_by_jwt_subject_type(type = :_not_given_)
  if type != :_not_given_
    @authorize_by_jwt_subject_type = type
  elsif instance_variable_defined?(:@authorize_by_jwt_subject_type)
    @authorize_by_jwt_subject_type
  end
end

#inherited(child) ⇒ Object



109
110
111
112
113
114
# File 'lib/zaikio/jwt_auth.rb', line 109

def inherited(child)
  super(child)

  child.instance_variable_set(:@authorize_by_jwt_subject_type, @authorize_by_jwt_subject_type)
  child.instance_variable_set(:@authorize_by_jwt_scopes, @authorize_by_jwt_scopes)
end