fixed ci4s oauth2接入

This commit is contained in:
xxq250 2024-10-23 11:19:02 +08:00
parent c0da80139a
commit d038f30994
3 changed files with 8 additions and 0 deletions

View File

@ -2,6 +2,10 @@ class Oauth::Ci4sController < Oauth::BaseController
include RegisterHelper
def oauth_url
Ci4s::Service.oauth_url(code)
end
# 需要educoder那边设置回调地址
def create
begin

View File

@ -23,6 +23,9 @@ module Ci4s::Service
config.dig("oauth", "ci4s", "redirect_uri")
end
def oauth_url
"#{base_url}/oauth/authorize?client_id=#{client_id}&redirect_uri=#{URI.encode_www_form_component(redirect_uri)}&response_type=code&grant_type=authorization_code"
end
def request(method, url, params)
begin

View File

@ -26,6 +26,7 @@ Rails.application.routes.draw do
get 'auth/failure', to: 'oauth/base#auth_failure'
get 'auth/cas/callback', to: 'oauth/cas#create'
get 'auth/acge/callback', to: "oauth/acge#create"
get 'oauth_ci4s', to: "oauth/ci4s#oauth_url"
get 'auth/ci4s/callback', to: "oauth/ci4s#create"
get 'auth/acge/refer', to: "oauth/acge#refer"
get 'auth/:provider/callback', to: 'oauth/callbacks#create'