sso server for ntu mb server site
This commit is contained in:
parent
db00b8c2b6
commit
5bb0f2c991
|
@ -0,0 +1,34 @@
|
|||
class SamlLoginsController < ApplicationController
|
||||
|
||||
require "net/http"
|
||||
require "uri"
|
||||
require 'rexml/document'
|
||||
include REXML
|
||||
|
||||
def index
|
||||
|
||||
if params[:wa] == "wsignoutcleanup1.0" #logout
|
||||
|
||||
redirect_to :root
|
||||
|
||||
else #login
|
||||
|
||||
|
||||
@wresult = params[:wresult]
|
||||
@wctx = params[:wctx]
|
||||
|
||||
@main_url = LIST[:sites][@wctx]['url']
|
||||
@main_public_key = LIST[:sites][@wctx]['key']
|
||||
|
||||
@doc = REXML::Document.new @wresult
|
||||
|
||||
public_key = OpenSSL::PKey::RSA.new(@main_public_key)
|
||||
encrypted_data = public_key.public_encrypt(@doc.elements["//saml:AttributeValue"].text)
|
||||
|
||||
redirect_to "http://#{@main_url}/user_login?" + { :wresult => encrypted_data }.to_param
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
|
@ -79,3 +79,32 @@ default_widget_style:
|
|||
- style3
|
||||
- style4
|
||||
- style5
|
||||
|
||||
sites:
|
||||
www:
|
||||
url: www.management.ntu.edu.tw
|
||||
key: "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmUuz5i/f9PCacIiTADln\na5xpbNh3tMwNSpnMZDa9FsGlw6/pKCkb5VuiusI7on8eZJGyneOrJ2L5tFael4pG\n0xmRMJnPm0FCaFjVO43Ktclehy5zIY7YJqqZo04j95oJrUBwAcB1xESpCx7atdpD\naFGdCtGQia+q/2cRSMic6JSALUtR3l1Xc5FCpC8n9DeYVOsOc4uO3MNuPvZ3MWPe\njULW4kojYcPL/2aHypi0iQKNm3Kss7mTW6/rsKNyhpds1YvdSqkak+QjqgR7hRDA\nFbYPNx4RL/o5RsxW12po7DdttsMHru0btrt+3Uw6TyqU+5cPcM6WJf2CV1/Fh1zm\njwIDAQAB\n-----END PUBLIC KEY-----\n"
|
||||
ba:
|
||||
url: ba.management.ntu.edu.tw
|
||||
key: "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsiVjWXc2OmyxK1O/N7R2\nsbhop1o4XStsxwcGm9AQNekoq7F8HEk2ZrSz5+hRln8FK4fT4YajALRQDS0nGUpe\nGmII0bvjQaiUvVvg7qMdUhdw88543VfPZShXZYjVaa/9JFEdw/+d5gHe5N8gTsde\nYY3KcIz6cECx56L2o5l4SNXYgCJt8aEtKOcsOM2ZDdoxTGJGWPxZaYvyKH9euTdC\nd8N/QGr6fzWcFEsefb1Ftxx417RRfJBFbqDsFIHGSGOPRKXwxL8/4qMDSZhtxHrK\nOdSvQhfF1YAr210TQxgdj/8Pl0PbuY0g8TM+S1izGjanT8vepuye7vUQ2vKRZ36z\nHwIDAQAB\n-----END PUBLIC KEY-----\n"
|
||||
acc:
|
||||
url: acc.management.ntu.edu.tw
|
||||
key: "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmhhNwvOI7hBu0qZfO8rU\nFg2lNw8Fmm5OUXm2Y/cElGaNWFVpRhJJGPQUV3tu9dMECi2n6yMvvgpXXeqYD/hV\nrlApoBb23o7HPg94cBckEO5vWVnZ4ylPS+GodOe+bFdSe4S/tjFY1KOcKN5rGNQQ\nFQ6JkWoQPBXcIoI4TqJVVAkjd8/x9jMRtK9ZzGGiRFhsbcP/A67kvz0fUsdMt4t1\nHmQJbCa2ONzJ8AGX1oTeHwXGz9ZPVstenci4o8lhwu1Jzim1UryW/XaPcYFH6wKm\nKwRAKJvn8awEvW4fzwD5fwI3u7cu19niT+KQAvDjV3HFuqnqu7LETCkr36hy30Hm\nIwIDAQAB\n-----END PUBLIC KEY-----\n"
|
||||
finance:
|
||||
url: finance.management.ntu.edu.tw
|
||||
key: "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxvRR2ay3HNjq/5rcGlBc\n2nFbQwCQK4nR/GqOUFAwdgWEIivwMALYWPQsNuU90RJqm0HkwxvdLXy/XRZfLSVC\nA5D3JtGmpstJKK7A1jOkP5sj54zs8NMnm2zrm9/YDrUmxUr58OOmsCIjiDXQ0PW+\nIR34FOde6yXgwriPUq2DjTo2UgujNPoNeICGmtTTV+YzVdOZmNqfRVnCpfUUnMsN\nDxzL8K2VzGa7KGJeCe5NEwCdJZ8FApMKUJORpCao9jR62dhZ0GKQpMqvO3c/aHxI\nWY+wnuzMWAZl96hIQc4ksnl7hcd2y5WSQZZS7OBdeSxumqJBqgCd6ITBhrzC5gSv\nCQIDAQAB\n-----END PUBLIC KEY-----\n"
|
||||
ib:
|
||||
url: ib.management.ntu.edu.tw
|
||||
key: "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzfoOcLyW3q7bYXArXEBC\nl62pLW7Yg0zyj5blWjU/DnIwxX6B8q48HfubDWQRGgHJsxCsGVrPwhUNEcmfS20q\nUlTBhx4Qt6qHXQYX0jBZbNg7fr2rbwNlbYovMUxF28dcik8K+eKz0fP2NH1lV4BS\ngDb9Nd/gNXozO67/MSrTCXXBKx8andlmVxhJSC8zQcQ4WXPpDhmTB0AvqUcRm/z7\nbLeIntibt6ke3/BVeixgu1Cf4u1y01+EsJ1sAnJzD+cSrq2tu5ccstbRfY5crY3v\n9YFQ3M9LrYV0fi91LhNt6xPNEvvQuZ21/Wwd9DL4D/7Hg55upcolfTxB3J83cTDg\niwIDAQAB\n-----END PUBLIC KEY-----\n"
|
||||
im:
|
||||
url: im.management.ntu.edu.tw
|
||||
key: "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAy1o15uvdBKra9LQsjnRL\nyaJ2ZTOLlaS0ICu/RkDWNTz4gbwKhAvxvS2Om9O85MiZKaOtS+TgrMePk/zTztZA\nnxrVcVZStzj5//zKuOLAg2DOUH0Bd/uBTjvOkfc6CQrJuu50B1S+GgN08KeZSxw4\nYgKn6I3Dnm8NZfl9foZRnGgpgJSUrv2oN2RWTBqkwey9LbWtZ0yoRdZHZpVDKq50\n4PpqgAibNXy4er06yd9qqWA0wIoPPQIsYhBkDmqkBe+AxTV4hqX8W/M+j3ftA+T9\nsKAhMYJD/sWvXA1LbKwiYn2f2GNo6zECCPdbYVwbwVeRHslt6lL11ZejW7jaXVaA\nAwIDAQAB\n-----END PUBLIC KEY-----\n"
|
||||
emba:
|
||||
url: emba.management.ntu.edu.tw
|
||||
key: "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzky+srC6d21nBP54Xtv+\nC6VJgjRolToLaaJKR6+qXW6lTU6/kYexfMiVTahcBtSooCDj137L/qn4NJpl/2UF\nXrx45n7FWWrXWJhlec6bh4Lg+wGcJrSDGF3GXhLD6T/0o++ep51zt5a6R3LW+WCg\nAUYzc6lWqSpKF/5Z3GfI4/jvNqrZLEoRtTR19WCjdO5J819XxUv3fW7TDx+XJ3kK\n9OsZWT81R7oushb2HFnGj0HJjwm5yCTFdWTzk6X/R0dAmg8lLcSDpeH1aq0YO/RB\nWycZEgIuV42eTaEg9aYbVnS7F2y8gIQjoVjlJF3VCsntzsaFpAEgXysla826Pna+\njQIDAQAB\n-----END PUBLIC KEY-----\n"
|
||||
ntugmba:
|
||||
url: ntugmba.management.ntu.edu.tw
|
||||
key: "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAs4WtrGLgj2FEZx+NnHzb\nK1HJ+V3qCJ7jIFH7mboeAjEPrAMLeFIdV4MvoasPALxuoo34oZl1NK6vYnfic5xk\nhV956QIzhB3vd4KDu1zbuYQO3ojlBSP3mbJPyHT6fKSkjLjKy0R5HEeT1+yLizC1\nMCPVBiP7mpaYIKPwfmMXFLA8GQxwBO2VpWpQD7jzd/+UWEXjKoK5t2uoMDL0k0w0\naffMcZKNntENXTRgnTq4iK39ayT95iXw81FH+LyEo5XtiHYsO2mhOPc9j5tU3GCO\nKwFmXPlh2+B1YwV+lkfCqpdT37Z3lLNFmw7sYidMvD3xIiFBsPKspoa1qlURmnuH\nvQIDAQAB\n-----END PUBLIC KEY-----\n"
|
||||
ia:
|
||||
url: ia.management.ntu.edu.tw
|
||||
key: "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvlVvwFF+k6/UI9+hhTEi\n032nTnEG/8l3ARfpSsTPwijsyk+e8Utjq3sslHVGlWzmT74KYHoMwNDYXiAH2wpS\n4k+vUugOPYNkY46smDG5oCGVVbmCORzzpZsccpXhFGft378NhNiTRNhk4DBMrFwb\nlALdd9sUDbqcc+PBJIW3KXD66+rcyImHpkEaa8t0rkAd1ZIkfLbXyQWikvOMWYvJ\n3K2+N/vVInAbVOmBwZgK0iP7ZvwvwR/li0nAkdD12jgvgrR6gP2pC+qyH15J2zib\nEz8aLweNBYq/BXGxtWxioFHif22v9LUj1fkAFqEoTwVCIGDdXn2/R9febBkSSPuL\ngQIDAQAB\n-----END PUBLIC KEY-----\n"
|
||||
|
|
Loading…
Reference in New Issue