Skip to content

Commit

Permalink
added CasrackTheAuthenticator::USERNAME_PARAM and used it as per the …
Browse files Browse the repository at this point in the history
…README
  • Loading branch information
jamesarosen committed Aug 4, 2009
1 parent a5f3c28 commit 7f16905
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions lib/casrack_the_authenticator.rb
@@ -1,5 +1,7 @@
module CasrackTheAuthenticator

USERNAME_PARAM = :cas_user

autoload :Simple, 'casrack_the_authenticator/simple'
autoload :Configuration, 'casrack_the_authenticator/configuration'
autoload :ServiceTicketValidator, 'casrack_the_authenticator/service_ticket_validator'
Expand Down
2 changes: 1 addition & 1 deletion lib/casrack_the_authenticator/fake.rb
Expand Up @@ -36,7 +36,7 @@ def call(env)
def process_basic_auth(env)
auth = Rack::Auth::Basic::Request.new(env)
if auth.provided? && auth.basic? && @usernames.include?(auth.username)
Rack::Request.new(env).session[:cas_user] = auth.username
Rack::Request.new(env).session[CasrackTheAuthenticator::USERNAME_PARAM] = auth.username
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/casrack_the_authenticator/require_cas.rb
Expand Up @@ -23,7 +23,7 @@ def call(env)

# @return [true, false] whether the user is signed in via CAS.
def signed_in?(env)
!Rack::Request.new(env).session[:cas_user].nil?
!Rack::Request.new(env).session[CasrackTheAuthenticator::USERNAME_PARAM].nil?
end

# @return [Array<Integer, Hash, String>] a 401 Unauthorized Rack response.
Expand Down
2 changes: 1 addition & 1 deletion lib/casrack_the_authenticator/simple.rb
Expand Up @@ -41,7 +41,7 @@ def process_return_from_cas(request)
ticket = request.params['ticket']
if ticket
validator = ServiceTicketValidator.new(@configuration, service_url(request), ticket)
request.session[:cas_user] = validator.user
request.session[CasrackTheAuthenticator::USERNAME_PARAM] = validator.user
end
end

Expand Down

0 comments on commit 7f16905

Please sign in to comment.