Merge Request #1

Merged
softwarepublico/omniauth-remote-user!1
Created by Macartur Sousa

Gitlab integration

Assignee: Antonio Terceiro
Milestone: None

Merged by Antonio Terceiro

Source branch has been removed
Commits (18)
2 participants
  • 5eb59358fc7b3b7402ae353f8fb36293?s=40&d=identicon
    Macartur Sousa @macartur

    @terceiro , can you review for us ?

    Choose File ...   File name...
    Cancel
  • 75e3b052e046e34cbb10917c5f9901d7?s=40&d=identicon
    Antonio Terceiro started a discussion on the outdated diff
    last updated by Antonio Terceiro
    config.ru
      1 +require 'sinatra'
      2 +require 'omniauth'
      3 +require 'json'
      4 +
      5 +module OmniAuth
      6 + module Strategies
      7 + class RemoteUser
    1
    • 75e3b052e046e34cbb10917c5f9901d7?s=40&d=identicon
      Antonio Terceiro @terceiro

      please remove this from config.ru since it's duplicating (an old version of) the actual code in lib/

      Choose File ...   File name...
      Cancel
    75e3b052e046e34cbb10917c5f9901d7?s=40&d=identicon
    Antonio Terceiro started a discussion on the outdated diff
    last updated by Macartur Sousa
    lib/omniauth/remote-user.rb
    3 3  
    4 4 module OmniAuth
    5 5 module Strategies
    6   - autoload :RemoteUser, 'omniauth/strategies/remote_user'
      6 + autoload :RemoteUser , 'omniauth/strategies/remote_user'
    2
    75e3b052e046e34cbb10917c5f9901d7?s=40&d=identicon
    Antonio Terceiro started a discussion on the outdated diff
    last updated by Antonio Terceiro
    lib/omniauth/strategies/remote_user.rb
    73 73 user_data = request.env['HTTP_REMOTE_USER_DATA']
    74 74 if user_data
    75 75 data = JSON.parse(user_data)
    76   - data['nickname'] = data['name']
      76 + data['nickname'] = data['firstname'] = data['name'].split()[0]
    6
    • 75e3b052e046e34cbb10917c5f9901d7?s=40&d=identicon
      Antonio Terceiro @terceiro

      really?

      Choose File ...   File name...
      Cancel
    • 75e3b052e046e34cbb10917c5f9901d7?s=40&d=identicon
      Antonio Terceiro @terceiro

      this does not look right

      Choose File ...   File name...
      Cancel
    • 5eb59358fc7b3b7402ae353f8fb36293?s=40&d=identicon
      Macartur Sousa @macartur

      So, I do it because the colab send data['name'] with full name (instance "firstname lastname") and the gitlab was getting a error, because the name can't have spaces.

      Choose File ...   File name...
      Cancel
    • 75e3b052e046e34cbb10917c5f9901d7?s=40&d=identicon
      Antonio Terceiro @terceiro

      but isn't data['nickname'] the actual username? This should be the value of the REMOTE_USER header.

      Choose File ...   File name...
      Cancel
    • 5eb59358fc7b3b7402ae353f8fb36293?s=40&d=identicon
      Macartur Sousa @macartur (Edited )

      ahh ok , I will change it to:

      data['nickname'] = uid

      data['firstname'] = data['name'].split()[0]

      data['last_name'] = data['name'].split()[1]

      this seems correct ?

      Choose File ...   File name...
      Cancel
    • 75e3b052e046e34cbb10917c5f9901d7?s=40&d=identicon
      Antonio Terceiro @terceiro

      yes

    75e3b052e046e34cbb10917c5f9901d7?s=40&d=identicon
    Antonio Terceiro started a discussion on the outdated diff
    last updated by Macartur Sousa
    omniauth-remote-user.gemspec
    6   - gem.add_runtime_dependency 'simplecov'
    7   - gem.add_runtime_dependency 'bundler'
    8   - gem.add_runtime_dependency 'rake'
    9   - gem.add_runtime_dependency 'rspec'
    10   - gem.add_runtime_dependency 'rack-test'
    11   - gem.add_runtime_dependency 'activerecord'
    12   -
      4 + gem.add_runtime_dependency 'omniauth', '~> 1.0'
    13 5 gem.name = 'omniauth-remote-user'
    14 6 gem.version = Omniauth::RemoteUser::VERSION
    15   - gem.description = %q{Authentication with Remote-User HTTP header for Omniauth.}
    16   - gem.summary = gem.description
    17   - gem.email = ['kanashiro.duarte@gmail.com', 'thiagitosouza@gmail.com', 'rodrigosiqueiramelo@gmail.com']
      7 + gem.description = 'Authentication with Remote-User HTTP header for Omniauth.'
      8 + gem.summary = 'Authentication with HTTP Remote User'
      9 + gem.email = ['kanashiro.duarte@gmail.com', 'thiagitosouza@gmail.com', 'rodrigosiqueiramelo@gmail.com','macartur.sc@gmail.com','Antonio Terceiro']
    2
    75e3b052e046e34cbb10917c5f9901d7?s=40&d=identicon
    Antonio Terceiro started a discussion on the diff
    last updated by Antonio Terceiro
    lib/omniauth/strategies/remote_user.rb
    37 36  
    38 37 def __logout(env)
    39 38 request = Rack::Request.new(env)
    40   - response = redirect_if_not_logging_in(request, request.path)
      39 + request.session.clear
      40 + response = redirect_if_not_logging_in(request, request.path )
    41 41 if response
    42   - response.delete_cookie(options.cookie)
    43   - response.delete_cookie(options.internal_cookie)
    44   - response
      42 + response.delete_cookie(options.internal_cookie , path: "#{request.script_name}" )
    3
  • 75e3b052e046e34cbb10917c5f9901d7?s=40&d=identicon
    Antonio Terceiro @terceiro

    mentioned in commit 4b0971

    Choose File ...   File name...
    Cancel