Created
June 15, 2017 10:19
-
-
Save zhangyuan/196074f757518e24bc6ea46dc458a7a2 to your computer and use it in GitHub Desktop.
A simple mock for passport saml (okta)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const SamlStrategy = require("passport-saml").Strategy; | |
| const oldAuthenticate = SamlStrategy.prototype.authenticate; | |
| export const mockAuthenticate = function (user) { | |
| SamlStrategy.prototype.authenticate = function () { | |
| this.success(user); | |
| }; | |
| }; | |
| export const mockRedirectToOkta = function () { | |
| SamlStrategy.prototype.authenticate = function (req) { | |
| req.res.redirect("http://okta.local/login"); | |
| }; | |
| }; | |
| export const restoreAuthenticate = function () { | |
| SamlStrategy.prototype.authenticate = oldAuthenticate; | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment