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, #computed_settings, #default_settings, #destroy_session!, #finalize_user_creation!, #login_path, #login_path_params, #logout_redirection_path, #name, #setup_proc, #uid_for_profile

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


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

def footer_html(*)
  '<div class="mu-footer-login-provider">
     <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>
  </div>'
end

#header_htmlObject



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

def header_html(*)
  <<HTML
 <script src="https://cdn.auth0.com/js/lock/11.5.2/lock.min.js"></script>
HTML
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



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

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