Update oauth2 url.
This commit is contained in:
parent
f2b9c159ca
commit
2ec284991a
|
@ -3,13 +3,13 @@ class SsoLoginBoxController < SessionsController
|
|||
OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE
|
||||
def oauth2_auth_page
|
||||
session[:referer_url] = params[:referer_url]
|
||||
redirect_to "https://nu04.ccu.edu.tw/oauth2.0/authorize?response_type=#{ENV['RESPONSE_TYPE']}&client_id=#{ENV['APP_ID']}&redirect_uri=#{ENV['REDIRECT_URI']}"
|
||||
redirect_to "https://cas.ccu.edu.tw/oauth2.0/authorize?response_type=#{ENV['RESPONSE_TYPE']}&client_id=#{ENV['APP_ID']}&redirect_uri=#{ENV['REDIRECT_URI']}"
|
||||
end
|
||||
def oauth2_sign_in
|
||||
# receive code from ntnu
|
||||
code = params[:code]
|
||||
# request token by code
|
||||
token_connection = Faraday.new 'https://nu04.ccu.edu.tw/oauth2.0/accessToken'
|
||||
token_connection = Faraday.new 'https://cas.ccu.edu.tw/oauth2.0/accessToken'
|
||||
token_response = token_connection.post do |request|
|
||||
request.params['grant_type'] = 'authorization_code'
|
||||
request.params['client_id'] = ENV['APP_ID']
|
||||
|
@ -22,7 +22,7 @@ class SsoLoginBoxController < SessionsController
|
|||
# render :html => {:code => code,:token => token, :response => token_response.body}
|
||||
|
||||
# request user id by token
|
||||
account_connection = Faraday.new 'https://nu04.ccu.edu.tw/oauth2.0/profile'
|
||||
account_connection = Faraday.new 'https://cas.ccu.edu.tw/oauth2.0/profile'
|
||||
account_response = account_connection.get do |request|
|
||||
request.params['access_token'] = token
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue