Class: Mumukit::Login::Provider::Auth0

Inherits:
Base
  • Object
show all
Defined in:
lib/mumukit/login/provider/auth0.rb

Instance Method Summary collapse

Methods inherited from Base

#auth_path, #button_html, #callback_path, #configure_rails_forgery_protection!, #login_path, #logout_redirection_path, #name

Instance Method Details

#configure_omniauth!(omniauth) ⇒ Object



2
3
4
5
6
7
8
# File 'lib/mumukit/login/provider/auth0.rb', line 2

def configure_omniauth!(omniauth)
  omniauth.provider :auth0,
                    auth0_config.client_id,
                    auth0_config.client_secret,
                    auth0_config.domain,
                    callback_path: callback_path
end


31
32
33
34
35
# File 'lib/mumukit/login/provider/auth0.rb', line 31

def footer_html(*)
  '<a href="https://auth0.com/" target="_blank">
      <img height="40" alt="JWT Auth for open source projects" src="//cdn.auth0.com/oss/badges/a0-badge-light.png"/>
   </a>'
end

#header_htmlObject



16
17
18
19
20
21
# File 'lib/mumukit/login/provider/auth0.rb', line 16

def header_html(*)
  " <script src=\"https://cdn.auth0.com/js/lock/10.14.0/lock.min.js\"></script>    \n </script>\n"
end

#request_authentication!(controller, login_settings) ⇒ Object



10
11
12
13
14
# File 'lib/mumukit/login/provider/auth0.rb', line 10

def request_authentication!(controller, )
  settings = lock_settings(controller, , {closable: false})
  controller.render_html! header: header_html,
                          body: script_html(settings)
end

#script_html(settings) ⇒ Object



23
24
25
26
27
28
29
# File 'lib/mumukit/login/provider/auth0.rb', line 23

def script_html(settings)
  "<script type=\"text/javascript\">   \n  new Auth0Lock('\#{auth0_config.client_id}', '\#{auth0_config.domain}', JSON.parse('\#{settings}')).show();   \n</script>\n"
end