Module: GrapeDeviseAuth

Extended by:
Forwardable
Defined in:
lib/grape_devise_auth.rb,
lib/grape_devise_auth/version.rb,
lib/grape_devise_auth/middleware.rb,
lib/grape_devise_auth/auth_headers.rb,
lib/grape_devise_auth/auth_helpers.rb,
lib/grape_devise_auth/concerns/user.rb,
lib/grape_devise_auth/configuration.rb,
lib/grape_devise_auth/authorizer_data.rb,
lib/grape_devise_auth/devise_interface.rb,
lib/grape_devise_auth/token_authorizer.rb,
lib/grape_devise_auth/errors/login_failed.rb,
lib/grape_devise_auth/errors/unauthorized.rb,
lib/grape_devise_auth/errors/logout_failed.rb,
lib/grape_devise_auth/errors/registration_failed.rb

Defined Under Namespace

Modules: AuthHelpers, Concerns Classes: AuthHeaders, AuthorizerData, Configuration, DeviseInterface, LoginFailed, LogoutFailed, Middleware, RegistrationFailed, TokenAuthorizer, Unauthorized

Constant Summary collapse

VERSION =
'0.0.4'

Class Method Summary collapse

Class Method Details

.add_auth_strategyObject



35
36
37
38
39
40
41
# File 'lib/grape_devise_auth.rb', line 35

def add_auth_strategy
  Grape::Middleware::Auth::Strategies.add(
    :grape_devise_auth,
    GrapeDeviseAuth::Middleware,
    ->(options) { [options[:resource_class]] }
  )
end

.config {|configuration| ... } ⇒ Object

Yields:



26
27
28
# File 'lib/grape_devise_auth.rb', line 26

def config
  yield(configuration)
end

.configurationObject



22
23
24
# File 'lib/grape_devise_auth.rb', line 22

def configuration
  @configuration ||= Configuration.new
end

.setup!(middleware = false) {|configuration| ... } ⇒ Object

Yields:



30
31
32
33
# File 'lib/grape_devise_auth.rb', line 30

def setup!(middleware = false)
  yield(configuration) if block_given?
  add_auth_strategy
end