Could not login Gitlab EE with OAuth2 generic provider.
Following is the configuration.##
gitlab_rails['omniauth_enabled'] = true
gitlab_rails['omniauth_allow_single_sign_on'] = ['oauth2_generic']
gitlab_rails['omniauth_block_auto_created_users'] = false
gitlab_rails['omniauth_auto_link_ldap_user'] = true
gitlab_rails['omniauth_providers'] = [
{
'name' => 'oauth2_generic',
'app_id' => 'git',
'app_secret' => '',
'args' => {
'client_options' => {
'site' => 'http://www.company.com',
'user_info_url' => '/api/open/OAuth/userinfo.htm',
authorize_url: '/api/admin/OAuth/authorize.htm',
'token_url' => '/api/open/OAuth/token.htm'
},
'user_response_structure' => {
'id_path' => 'sub',
'root_path' => [],
'attributes' => {
'name' => 'username',
'nickname' => 'name',
'email' => 'email'
}
},
'name' => 'OAuth',
'strategy_class' => "OmniAuth::Strategies::OAuth2Generic"
}
}
]
gitlab production.log
Started POST "/users/auth/OAuth" for 121.69.29.10 at 2017-12-06 10:14:15 +0800
Processing by Gitlab::RequestForgeryProtection::Controller#index as HTML
Parameters: {"authenticity_token"=>"[FILTERED]"}
Completed 200 OK in 1ms (ActiveRecord: 0.0ms | Elasticsearch: 0.0ms)
Started GET "/users/auth/OAuth/callback?code=[FILTERED]&state=cef51d8e12029adbe1c0d3df10a4131a18b5779806539075" for 121.69.29.10 at 2017-12-06 10:14:15 +0800
Processing by OmniauthCallbacksController#failure as HTML
Parameters: {"code"=>"[FILTERED]", "state"=>"cef51d8e12029adbe1c0d3df10a4131a18b5779806539075"}
Redirected to http://gitlab.mucang.cn/users/sign_in
Completed 302 Found in 6ms (ActiveRecord: 0.0ms | Elasticsearch: 0.0ms)
Started GET "/users/sign_in" for 121.69.29.10 at 2017-12-06 10:14:15 +0800
Processing by SessionsController#new as HTML
Completed 200 OK in 706ms (Views: 582.0ms | ActiveRecord: 5.5ms | Elasticsearch: 0.0ms)
