Revert "fix checks for empty config options"
This reverts commit ef6cdb11cd.
This commit is contained in:
parent
c590cab920
commit
1d194ff2b2
1 changed files with 6 additions and 9 deletions
15
library.js
15
library.js
|
|
@ -38,10 +38,7 @@
|
||||||
params.router.get('/admin/plugins/sso-saml', params.middleware.admin.buildHeader, render);
|
params.router.get('/admin/plugins/sso-saml', params.middleware.admin.buildHeader, render);
|
||||||
params.router.get('/api/admin/plugins/sso-saml', render);
|
params.router.get('/api/admin/plugins/sso-saml', render);
|
||||||
|
|
||||||
if (master_config.idp_entry_point !== "" &&
|
if (master_config.idp_entry_point && master_config.callback_path && master_config.issuer && master_config.metadata) {
|
||||||
master_config.callback_path !== "" &&
|
|
||||||
master_config.issuer !== "" &&
|
|
||||||
master_config.metadata !== "") {
|
|
||||||
console.log("creating samlObj");
|
console.log("creating samlObj");
|
||||||
samlObj = new passportSAML({
|
samlObj = new passportSAML({
|
||||||
path: master_config.callback_path,
|
path: master_config.callback_path,
|
||||||
|
|
@ -82,9 +79,9 @@
|
||||||
|
|
||||||
if (samlObj){
|
if (samlObj){
|
||||||
|
|
||||||
if (master_config.metadata !== "") {
|
if (master_config.metadata) {
|
||||||
params.router.get(master_config.metadata, function(req, res) {
|
params.router.get(master_config.metadata, function(req, res) {
|
||||||
if (master_config.server_crt !== ""){
|
if (master_config.server_crt){
|
||||||
var cert = fs.readFileSync(master_config.server_crt, 'utf-8');
|
var cert = fs.readFileSync(master_config.server_crt, 'utf-8');
|
||||||
res.header("Content-Type", "application/xml");
|
res.header("Content-Type", "application/xml");
|
||||||
res.send(samlObj.generateServiceProviderMetadata(cert))
|
res.send(samlObj.generateServiceProviderMetadata(cert))
|
||||||
|
|
@ -98,7 +95,7 @@
|
||||||
params.router.post(master_config.callback_path,
|
params.router.post(master_config.callback_path,
|
||||||
passport.authenticate('saml'),
|
passport.authenticate('saml'),
|
||||||
function(req, res, next){
|
function(req, res, next){
|
||||||
if (master_config.login_redirect_url !== ""){
|
if (master_config.login_redirect_url){
|
||||||
res.redirect(master_config.login_redirect_url);
|
res.redirect(master_config.login_redirect_url);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
|
@ -109,7 +106,7 @@
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
if (master_config.logout_url !== "") {
|
if (master_config.logout_url) {
|
||||||
|
|
||||||
params.router.get(master_config.logout_url,function(req,res){
|
params.router.get(master_config.logout_url,function(req,res){
|
||||||
if (req.user && parseInt(req.user.uid, 10) > 0) {
|
if (req.user && parseInt(req.user.uid, 10) > 0) {
|
||||||
|
|
@ -120,7 +117,7 @@
|
||||||
|
|
||||||
req.logout();
|
req.logout();
|
||||||
|
|
||||||
if (master_config.logout_redirect_url !== ""){
|
if (master_config.logout_redirect_url){
|
||||||
res.redirect(master_config.logout_redirect_url);
|
res.redirect(master_config.logout_redirect_url);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue