Commit 9926a21b authored by Jacob Vosmaer's avatar Jacob Vosmaer

Put key in constant

parent 7bc16acd
require 'omniauth/strategies/kerberos_spnego'
class OmniauthKerberosSpnegoController < ApplicationController class OmniauthKerberosSpnegoController < ApplicationController
include KerberosSpnegoHelper include KerberosSpnegoHelper
...@@ -5,7 +7,7 @@ class OmniauthKerberosSpnegoController < ApplicationController ...@@ -5,7 +7,7 @@ class OmniauthKerberosSpnegoController < ApplicationController
def negotiate def negotiate
if spnego_provided? && (krb_principal = spnego_credentials!(spnego_token)) if spnego_provided? && (krb_principal = spnego_credentials!(spnego_token))
session[:kerberos_spnego_principal_name] = krb_principal session[OmniAuth::Strategies::KerberosSpnego::SESSION_KEY] = krb_principal
send_final_spnego_response send_final_spnego_response
redirect_to user_kerberos_spnego_omniauth_callback_path redirect_to user_kerberos_spnego_omniauth_callback_path
return return
......
...@@ -6,6 +6,8 @@ module OmniAuth ...@@ -6,6 +6,8 @@ module OmniAuth
include OmniAuth::Strategy include OmniAuth::Strategy
include Gitlab::Routing.url_helpers include Gitlab::Routing.url_helpers
SESSION_KEY = :kerberos_spnego_principal_name
option :name, 'kerberos_spnego' option :name, 'kerberos_spnego'
uid { username } uid { username }
...@@ -25,7 +27,7 @@ module OmniAuth ...@@ -25,7 +27,7 @@ module OmniAuth
def principal_name def principal_name
return @principal_name if defined?(@principal_name) return @principal_name if defined?(@principal_name)
@principal_name = session.delete(:kerberos_spnego_principal_name) @principal_name = session.delete(SESSION_KEY)
end end
def request_phase def request_phase
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment