Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with being redirected to reauthenticate after login #1

Open
robdimarco opened this issue Aug 4, 2011 · 1 comment
Open
Assignees

Comments

@robdimarco
Copy link
Owner

I could successfully login into crowd using this plugin, but if I will login in some other our crowd resource and
then will try to redirect on /auth/crowd/ in my application then I will have the 'login into crowd' screen again, while I expecting
already being logged (like using twitter provider for omniauth).

No matter logged I somewhere on not in crowd it everytimes asks me to login again from my app. Is this is a limitation of this plugin or I am doing something
wrong ?

@ghost ghost assigned robdimarco Aug 4, 2011
@robdimarco
Copy link
Owner Author

I am only using :crowd as provider in my project, twitter was used in test purposes, I just wanted to check
differenses with crawd login behavior and twitter.

I will copy few code samples, may be you could point me in the source of the problem.

omniauth.rb:

require 'net/http'

Rails.application.config.middleware.use OmniAuth::Builder do
  provider :crowd, :crowd_server_url=>"http://xx.xx.xx.xx:17004/crowd", :application_name=>"bama", :application_password=>"bama"
end

routes.rb:

get '/auth/:provider/callback' => "login#callback"
get '/auth/:provider/failure' => "login#failed"

LoginController.rb

def index
  @msg = request.env['omniauth.auth']

  render "index"
end

def failed
  @msg = "failed"
  render "index"
end

View for controller just rendering the @msg property. So it is easy as a pie and I have no idea what is wrong with this code.
English is not my native language, may be I am not too strict, I will try to explain again :)

When I am logging into crowd from my application (/crowd/auth/, then entering the credentials) - I am getting next data from request.env['omniauth.auth']:

{"provider"=>"crowd", "uid"=>"bama1", "user_info"=>{"name"=>"Bama 1", "first_name"=>"Bama", "last_name"=>"1", "email"=>"bama1@test123.com"}}

If I am entering wrong credentials, '/auth/:provider/failure' triggers, so I have assumed that when I getting the above callback ->
user is logged.

But next time I am logging again in few seconds - I got rendered 'crowd login page again'. Even if I logging into crowd console from
web and then again accessing /crowd/auth while being logged - I still getting 'enter credentials' page.
In such situation , when testing twitter - I was not redirected on login page and there was oauth token param proveded in request automatically.

@robdimarco robdimarco reopened this Aug 4, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant