Module: Authkeeper

Defined in:
lib/authkeeper.rb,
lib/authkeeper/engine.rb,
lib/authkeeper/version.rb,
lib/authkeeper/container.rb,
lib/authkeeper/configuration.rb,
app/lib/authkeeper/jwt_encoder.rb,
app/jobs/authkeeper/application_job.rb,
app/lib/authkeeper/github_api/client.rb,
app/lib/authkeeper/gitlab_api/client.rb,
app/lib/authkeeper/google_api/client.rb,
app/lib/authkeeper/yandex_api/client.rb,
app/services/authkeeper/providers/vk.rb,
app/lib/authkeeper/vk_auth_api/client.rb,
app/models/authkeeper/application_record.rb,
app/services/authkeeper/providers/github.rb,
app/services/authkeeper/providers/gitlab.rb,
app/services/authkeeper/providers/google.rb,
app/services/authkeeper/providers/yandex.rb,
app/helpers/authkeeper/application_helper.rb,
app/lib/authkeeper/github_auth_api/client.rb,
app/lib/authkeeper/gitlab_auth_api/client.rb,
app/lib/authkeeper/google_auth_api/client.rb,
app/lib/authkeeper/yandex_auth_api/client.rb,
app/mailers/authkeeper/application_mailer.rb,
lib/authkeeper/controllers/authentication.rb,
app/services/authkeeper/providers/telegram.rb,
app/lib/authkeeper/github_api/requests/user.rb,
app/lib/authkeeper/gitlab_api/requests/user.rb,
app/lib/authkeeper/google_api/requests/user.rb,
app/lib/authkeeper/yandex_api/requests/info.rb,
app/lib/authkeeper/vk_auth_api/requests/info.rb,
app/services/authkeeper/fetch_session_service.rb,
app/services/authkeeper/generate_token_service.rb,
app/lib/authkeeper/github_api/requests/user_emails.rb,
app/controllers/authkeeper/omniauth_callbacks_controller.rb,
app/lib/authkeeper/yandex_auth_api/requests/access_token.rb,
app/lib/authkeeper/vk_auth_api/requests/fetch_access_token.rb,
app/lib/authkeeper/github_auth_api/requests/fetch_access_token.rb,
app/lib/authkeeper/gitlab_auth_api/requests/fetch_access_token.rb,
app/lib/authkeeper/google_auth_api/requests/fetch_access_token.rb

Defined Under Namespace

Modules: ApplicationHelper, Controllers, GithubApi, GithubAuthApi, GitlabApi, GitlabAuthApi, GoogleApi, GoogleAuthApi, Providers, VkAuthApi, YandexApi, YandexAuthApi Classes: ApplicationJob, ApplicationMailer, ApplicationRecord, Configuration, Container, Engine, FetchSessionService, GenerateTokenService, JwtEncoder, OmniauthCallbacksController

Constant Summary collapse

VERSION =
'0.1.4'

Class Method Summary collapse

Class Method Details

.configurationObject

Public: Returns Authkeeper::Configuration instance.



31
32
33
34
35
36
# File 'lib/authkeeper.rb', line 31

def configuration
  return Authkeeper::Container.resolve(:configuration) if Authkeeper::Container.key?(:configuration)

  Authkeeper::Container.register(:configuration) { Configuration.new }
  Authkeeper::Container.resolve(:configuration)
end

.configure {|configuration| ... } ⇒ Object

Public: Configure authkeeper.

Authkeeper.configure do |config|
  config.user_model = 'User'
  config.omniauth :github, client_id: 'id', client_secret: 'secret', redirect_url: 'redirect_url'
  config.omniauth :gitlab, client_id: 'id', client_secret: 'secret', redirect_url: 'redirect_url'
  config.omniauth :google, client_id: 'id', client_secret: 'secret', redirect_uri: 'redirect_uri'
  config.omniauth :telegram, client_id: 'id', client_secret: 'secret', bot_secret: 'bot_secret'
  config.omniauth :yandex, client_id: 'id', client_secret: 'secret', redirect_uri: 'redirect_uri'
end

Yields:



24
25
26
27
28
# File 'lib/authkeeper.rb', line 24

def configure
  yield configuration

  configuration.validate
end