Class: SidekiqWebGoogleAuth::Builder

Inherits:
OmniAuth::Builder
  • Object
show all
Defined in:
lib/sidekiq_web_google_auth/builder.rb

Defined Under Namespace

Classes: ArgumentError

Constant Summary collapse

ARGUMENT_ERROR =
"You must provide authorized_emails or authorized_emails_domains (or both)"

Instance Method Summary collapse

Instance Method Details

#provider(*args, authorized_emails: [], authorized_emails_domains: [], **options, &block) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/sidekiq_web_google_auth/builder.rb', line 11

def provider(*args, authorized_emails: [], authorized_emails_domains: [], **options, &block)
  invalid_arguments! if authorized_emails.empty? && authorized_emails_domains.empty?
  super("google_oauth2", *args, options.merge(name: "oauth"), &block)

  SidekiqWebGoogleAuth::Extension.authorized_emails = authorized_emails
  SidekiqWebGoogleAuth::Extension.authorized_emails_domains = authorized_emails_domains
  Sidekiq::Web.register(SidekiqWebGoogleAuth::Extension)
end