Project

General

Profile

Actions

Patch #5966

closed

change to allow openID to use Google Apps

Added by Chris Mague over 14 years ago. Updated almost 3 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
OpenID
Target version:
-
Start date:
2010-07-26
Due date:
% Done:

100%

Estimated time:

Description

diff -r ./config/environment.rb /home/chris/tmp/redmine/them/redmine-1.0.0/config/environment.rb
61,62d60
< 
< require 'gapps_openid'
diff -r ./app/controllers/account_controller.rb /home/chris/tmp/redmine/them/redmine-1.0.0/app/controllers/account_controller.rb
161,164c161
<     r = authenticate_with_open_id(openid_url, :required => ["http://schema.openid.net/contact/email"], :return_to => signin_url) do |result, identity_url, registration|
<       logger.warn "Failed login because: '#{result.inspect} at #{Time.now.utc}" 
<       logger.warn "Failed login because: '#{result} at #{Time.now.utc}" 
<       logger.warn "Failed login because: '#{result.message} at #{Time.now.utc}" 
---
>     authenticate_with_open_id(openid_url, :required => [:nickname, :fullname, :email], :return_to => signin_url) do |result, identity_url, registration|
166,170c163
<         logger.warn "identity_url: '#{identity_url} at #{Time.now.utc}" 
<         logger.warn "registration: '#{registration.inspect} at #{Time.now.utc}" 
<         #user = User.find_or_initialize_by_identity_url(identity_url)
<         logger.warn "registration: '#{registration["http://schema.openid.net/contact/email"][0]}'" 
<         user = User.find_by_mail(registration["http://schema.openid.net/contact/email"][0])
---
>         user = User.find_or_initialize_by_identity_url(identity_url)
Actions #1

Updated by Holger Just over 14 years ago

Just wrapped the description in pre tags.

Actions #2

Updated by Felix Schäfer over 14 years ago

The OpenID endpoint for Google accounts is https://www.google.com/accounts/o8/id , and from what I hear it works well. Please state what problem this patch is supposed to solve.

Actions #3

Updated by Toshi MARUYAMA over 13 years ago

  • Category set to Accounts / authentication
Actions #4

Updated by Andriy Lesyuk over 13 years ago

Google OpenID does not work for me under versions 1.0.1 and 1.1.2... I have investigated a little this issue and found that changing the open_id_authenticate function to the following code helps (includes more attributes than Chris' patch):

  def open_id_authenticate(openid_url)
    authenticate_with_open_id(openid_url, :required => [:nickname, :fullname, :email,
        'http://axschema.org/namePerson/first', 'http://axschema.org/namePerson/last', 'http://axschema.org/contact/email'
      ], :return_to => signin_url) do |result, identity_url, registration|
      if result.successful?
        user = User.find_or_initialize_by_identity_url(identity_url)
        if user.new_record?
          # Self-registration off
          redirect_to(home_url) && return unless Setting.self_registration?

          # Create on the fly
          user.login = registration['nickname'] unless registration['nickname'].nil?
          user.mail = registration['email'] unless registration['email'].nil?
          user.firstname, user.lastname = registration['fullname'].split(' ') unless registration['fullname'].nil?

          user.login = registration['http://axschema.org/contact/email'].first unless registration['http://axschema.org/contact/email'].nil?
          user.mail = registration['http://axschema.org/contact/email'].first unless registration['http://axschema.org/contact/email'].nil?
          user.firstname = registration['http://axschema.org/namePerson/first'].first unless registration['http://axschema.org/namePerson/first'].nil?
          user.lastname = registration['http://axschema.org/namePerson/last'].first unless registration['http://axschema.org/namePerson/last'].nil?

          user.random_password
          user.register

          case Setting.self_registration
          when '1'
            register_by_email_activation(user) do
              onthefly_creation_failed(user)
            end
          when '3'
            register_automatically(user) do
              onthefly_creation_failed(user)
            end
          else
            register_manually_by_administrator(user) do
              onthefly_creation_failed(user)
            end
          end          
        else
          # Existing record
          if user.active?
            successful_authentication(user)
          else
            account_pending
          end
        end
      end
    end
  end

See also:

Unless I missed something it looks like Google OpenID does not work at all in Redmine!

Actions #5

Updated by Etienne Massip about 13 years ago

  • Category changed from Accounts / authentication to OpenID
Actions #6

Updated by Antoine Beaupré almost 13 years ago

  • % Done changed from 0 to 100

there is a fix for this: http://projects.andriylesyuk.com/projects/openid-fix

why isn't this factored in?!

Actions #7

Updated by Go MAEDA almost 3 years ago

  • Status changed from New to Closed

The OpenID support has been dropped by #35755 for the upcoming Redmine 5.0.0.

Actions

Also available in: Atom PDF