Module: Jwtauth

Defined in:
lib/jwtauth.rb,
lib/jwtauth/user.rb,
lib/jwtauth/introduction.rb

Defined Under Namespace

Modules: Apiv01Controller, Controller, Model, Policy, Test Classes: AuthorizedError, ExpiredError, Introduction, Session, SocketError, UnauthorizedError, User

Constant Summary collapse

@@session_entity =

Entity represent for current session mattr_accessor :session_entity

Jwtauth::User
@@jwt_rsa_pub =

Read file contain public key used when decoding jwt. mattr_accessor :jwt_rsa_pub

nil
@@session_path =

Define authservice path for get session (jwt) mattr_accessor :session_path

nil
@@service_name =

Define current service contain entities mattr_accessor :service_name

nil
@@namespace =

Define namespace (String | Array) include current service for service mattr_accessor :namespace

nil
@@algorithm =

Algorithm, JWT use to encode mattr_accessor :algorithm

'RS256'
@@headers_names =

Setting name of authentication params

{
  :'access-token' => 'access-token',
  :'client' => 'client',
  :'expiry' => 'expiry',
  :'uid' => 'uid',
  :'token-type' => 'token-type'
}
@@test_mode =

Option when used jwtauth

false
@@current_user =

Save temp current_user

nil

Class Method Summary collapse

Class Method Details

.algorithmObject



93
94
95
# File 'lib/jwtauth.rb', line 93

def self.algorithm
  @@algorithm
end

.algorithm=(algorithm) ⇒ Object



97
98
99
# File 'lib/jwtauth.rb', line 97

def self.algorithm=(algorithm)
  @@algorithm = algorithm
end

.current_userObject



117
118
119
# File 'lib/jwtauth.rb', line 117

def self.current_user
  @@current_user
end

.current_user=(current_user) ⇒ Object



121
122
123
# File 'lib/jwtauth.rb', line 121

def self.current_user=(current_user)
  @@current_user = current_user
end

.headers_namesObject



125
126
127
# File 'lib/jwtauth.rb', line 125

def self.headers_names
  @@headers_names
end

.headers_names=(headers_names) ⇒ Object



129
130
131
# File 'lib/jwtauth.rb', line 129

def self.headers_names=(headers_names)
  @@headers_names = @@headers_names.merge(headers_names) if headers_names.is_a?(Hash)
end

.jwt_rsa_pubObject



61
62
63
# File 'lib/jwtauth.rb', line 61

def self.jwt_rsa_pub
  @@jwt_rsa_pub
end

.jwt_rsa_pub=(jwt_rsa_pub) ⇒ Object



65
66
67
# File 'lib/jwtauth.rb', line 65

def self.jwt_rsa_pub=(jwt_rsa_pub)
  @@jwt_rsa_pub = jwt_rsa_pub
end

.namespaceObject



85
86
87
# File 'lib/jwtauth.rb', line 85

def self.namespace
  @@namespace
end

.namespace=(namespace) ⇒ Object



89
90
91
# File 'lib/jwtauth.rb', line 89

def self.namespace=(namespace)
  @@namespace = namespace
end

.service_nameObject



77
78
79
# File 'lib/jwtauth.rb', line 77

def self.service_name
  @@service_name
end

.service_name=(service_name) ⇒ Object



81
82
83
# File 'lib/jwtauth.rb', line 81

def self.service_name=(service_name)
  @@service_name = service_name
end

.session_entityObject



53
54
55
# File 'lib/jwtauth.rb', line 53

def self.session_entity
  @@session_entity
end

.session_entity=(session_entity) ⇒ Object



57
58
59
# File 'lib/jwtauth.rb', line 57

def self.session_entity=(session_entity)
  @@session_entity = session_entity
end

.session_pathObject



69
70
71
# File 'lib/jwtauth.rb', line 69

def self.session_path
  @@session_path
end

.session_path=(session_path) ⇒ Object



73
74
75
# File 'lib/jwtauth.rb', line 73

def self.session_path=(session_path)
  @@session_path = session_path
end

.setup {|_self| ... } ⇒ Object

Default way to set up Jwtauth. a fresh initializer with all configuration values.

Yields:

  • (_self)

Yield Parameters:

  • _self (Jwtauth)

    the object that the method was called on



49
50
51
# File 'lib/jwtauth.rb', line 49

def self.setup
  yield self
end

.test_modeObject



101
102
103
# File 'lib/jwtauth.rb', line 101

def self.test_mode
  @@test_mode
end

.test_mode!Object



109
110
111
# File 'lib/jwtauth.rb', line 109

def self.test_mode!
  @@test_mode = true
end

.test_mode=(test_mode) ⇒ Object



105
106
107
# File 'lib/jwtauth.rb', line 105

def self.test_mode=(test_mode)
  @@test_mode = test_mode
end

.test_mode?Boolean

Returns:

  • (Boolean)


113
114
115
# File 'lib/jwtauth.rb', line 113

def self.test_mode?
  @@test_mode
end