Module: Shakha

Defined in:
lib/shakha.rb,
lib/shakha/pkce.rb,
lib/shakha/config.rb,
lib/shakha/engine.rb,
lib/shakha/version.rb,
lib/shakha/pairwise.rb,
lib/shakha/middleware.rb,
app/models/shakha/user.rb,
lib/shakha/jwt_handler.rb,
app/models/shakha/client.rb,
lib/shakha/error_handler.rb,
app/models/shakha/session.rb,
lib/shakha/controller_helpers.rb,
app/controllers/shakha/auth_controller.rb,
app/controllers/shakha/jwks_controller.rb,
app/controllers/shakha/openid_controller.rb,
app/controllers/shakha/session_controller.rb,
app/controllers/shakha/application_controller.rb

Defined Under Namespace

Modules: ControllerHelpers, ErrorHandler, PKCEMixin, Pairwise Classes: ApplicationController, AuthController, Client, Config, ConfigurationError, Engine, GoogleOAuthError, JWTError, JwksController, JwtHandler, Middleware, OpenidController, PKCEError, Session, SessionController, User

Constant Summary collapse

VERSION =
"0.1.0"

Class Method Summary collapse

Class Method Details

.configObject



13
14
15
# File 'lib/shakha.rb', line 13

def config
  @config ||= Config.new
end

.derive_pairwise_sub(google_sub, client_id = nil) ⇒ Object



25
26
27
# File 'lib/shakha.rb', line 25

def derive_pairwise_sub(google_sub, client_id = nil)
  Pairwise.derive(google_sub, client_id || default_client_id)
end

.setup {|config| ... } ⇒ Object

Yields:



9
10
11
# File 'lib/shakha.rb', line 9

def setup
  yield(config)
end

.sign_token(payload, exp: 24.hours.from_now) ⇒ Object



21
22
23
# File 'lib/shakha.rb', line 21

def sign_token(payload, exp: 24.hours.from_now)
  JwtHandler.encode(payload, exp: exp)
end

.verify_token(id_token, audience: nil) ⇒ Object



17
18
19
# File 'lib/shakha.rb', line 17

def verify_token(id_token, audience: nil)
  JwtHandler.verify(id_token, audience: audience || default_audience)
end