ntu coph sso server
This commit is contained in:
parent
077e98a6d4
commit
e89656cdd1
|
@ -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
|
|
@ -80,3 +80,27 @@ default_widget_style:
|
|||
- style3
|
||||
- style4
|
||||
- style5
|
||||
|
||||
sites:
|
||||
coph:
|
||||
url: coph.ntu.edu.tw
|
||||
key: "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzpqn0cXyC98jZ2hk4F8W\n0K7qgNSqHvH8unxCbgEuxWvkUA1ld2NMfsj9fTl9f2UlhPtwiaZchVAFSDjpYeQD\nH3A5XtlonUXfTD5XdnKBvk6WtKl7cFuyhIazcxp3MA8/cmSuGbXIjyZLMiUkElZg\n5CZ/1n+yhGFjXQz/d4d8W7sN7AjmhHjTi5vgJF4fkaSr1g6TwWJfLhhzzYsva2z/\nDRkQl3OpUEbSQP1X9/RmManDrYpn7Wrqi9Joqu7rPk0Grki8lCo5T/kaEsQ0wKte\nt7N9QRCBM/f2tOYoH+elitnOJq9zAtAtGaw80xso/GkjMHhcmPnI2YZ90yy1Fvau\nOwIDAQAB\n-----END PUBLIC KEY-----\n"
|
||||
dph:
|
||||
url: dph.ntu.edu.tw
|
||||
key: "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0wNXuqsY6iHiPORSA+M1\nQzzoepGnJGSP92VszqTp7M+rDf6R98J+jFzG4YkMMUaFids4sXTwVp3zfgmhfl5k\nLJiufcXk9U5HYQ5b88kW+8BOAj9GBMQ7tDTw5hkFGL98anAAxZgW/FVovlAr3jv7\nei5/MBRPwctuOYhR4s9Mh47tbCnMFOswyjErEp5OfkbTo+qar44f2m4d1RVPTM1k\n0RCU65+0syw+hYgg01yRuWkSNzHie5FOVD7CujWeTD2CVZFh72kaGLp99ExOtrM3\n7AzS8duVmty/f7RG8DiJdB4a/mcHjcanlBLcowoo3FaaA1Arg1DkdjH0zwB2UVMs\nEQIDAQAB\n-----END PUBLIC KEY-----\n"
|
||||
ntuhpm:
|
||||
url: ntuhpm.ntu.edu.tw
|
||||
key: "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAq/kK75YjD3Yvv9wacE0+\ncImWxnVcVFXhtG5T8Hm0tkit3OroJ2BobWHe23QBThnzXCF4+S1XosYw60XPNAKk\nrmImHry9lG2iz/UfXwj49AfMHOw0tpOcf2UHiVAZUKb9zZRAEDL6WbhVQ5C/9jZ1\nKWtrcArRxck1tivgT5tUaKrCHrnj9/jo6eAHiKg0CsEfS0hlXQFfo7/2kBZc0oBq\ntuVyoDADaY1PoyvqzHxZC3eyUTjURVa0+Lkpw9d9jbSUNnf2XfEi51Rt79PlrtNj\naxsQ2UKhz0xYouTXQPt9Mc+vxow9bvd1CPr52ywX37sjRlmOQ4gpcxEPa21bRevW\nwwIDAQAB\n-----END PUBLIC KEY-----\n"
|
||||
epm:
|
||||
url: epm.ntu.edu.tw
|
||||
key: "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgk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kR8HIUEBxtzvD57CsHaaGKrxxAf\nd8XJh5nXZCg5RaoQVaBNjFBmOPm4jZAWPUFPuGRow8Uzs/LzA5HNew196g+qWayB\nglTyX2TJUAADyx6Peq4ZNqEBBB68n4DyugXzfvlk0yXsrLDtbM44bzOhRuosKa7Y\nung+IonA5lqr2mJDrTMDOupIAgW6/4xO7ww2e/pMOVtfoVSw+5YfXFBGCbRjGKwT\nZ4b7whRBBuRd1lgWhQrzOikb+/NtEVQWLpWPpSeTFx5sIUyb5PmQTXtRxZX1xNcS\neQIDAQAB\n-----END PUBLIC KEY-----\n"
|
||||
mph:
|
||||
url: mph.ntu.edu.tw
|
||||
key: "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA7rlich0iWAWKUhT7pHji\nOHeEURjnykiX5ElkBD7twy5UyagiD9wVeBOi7mElaJjcR84WfoZVTJVbI08/a5KY\neFURiOy4CigwIFyiDKhwMH5XETuQD96JFqClZGgfxaZAtt9IEpqE3HbqGpPh/0Oc\noLP6Pez8icDYqShZrrZioQZ9XshlZJ6Xt2iStMHNucKHrptMylvtHo6sp/Uy00jC\nubbtH7cvAbQf/Ee/jbGWWMyVwjko1h8u1pMtQlXIC6R0UP6yfCAg7c/0P9eb33OE\n2B6t9i/7kdqTysyKvf6jdDeJeyDYxZVFFXEETu5TzffdhrEK67KAot3J3hi0Qwq7\nvQIDAQAB\n-----END PUBLIC KEY-----\n"
|
||||
|
||||
|
|
|
@ -13,6 +13,8 @@ Orbit::Application.routes.draw do
|
|||
match 'user_logout' => 'sessions#destroy'
|
||||
end
|
||||
|
||||
match "saml_login" => 'saml_logins#index'
|
||||
|
||||
mount Resque::Server, :at => "/admin/resque"
|
||||
mount Rack::GridFS::Endpoint.new(:db => Mongoid.database,:lookup=>:path), :at => "gridfs"
|
||||
|
||||
|
|
Reference in New Issue