gitlab_rails['omniauth_providers'] = [ { 'name' => 'oauth2_generic', 'app_id' => 'faff0a71-45d5-4636-a91c-ff637888745c', # oauth2的app_id 由sso服务进行分配 'app_secret' => 'TsittyC1.nr4LcBjf8p9ud2E0H', # oauth2的app_secret 由sso服务进行分配 'args' => { client_options: { 'site' => 'https://api.junyao.com/hydra', # sso的地址 'authorize_url' => '/oauth2/auth', # 认证URL 'token_url' => '/oauth2/token', # 获取token的URL 'user_info_url' => '/userinfo' # 获取用户信息的URL }, user_response_structure: { root_path: [], # i.e. if attributes are returned in JsonAPI format (in a 'user' node nested under a 'data' node) id_path: ['uid'], # 此处的用户信息如何配置 我会在下面详细说明 attributes: { name: 'username', nickname: 'nickname',email:'email'} # 此处的用户信息如何配置 我会在下面详细说明 # optionally, you can add the following two lines to "white label" the display name # of this strategy (appears in urls and Gitlab login buttons) # If you do this, you must also replace oauth2_generic, everywhere it appears above, with the new name. name: 'SSO', # 此处的属性值会在登陆处,以及设置identitifier时使用到,建议英文(不支持中文) strategy_class: "OmniAuth::Strategies::OAuth2Generic" # Devise-specific config option Gitlab uses to find renamed strategy } } ]