@@ -59,7 +59,8 @@ async function configureOIDC(req, res, next) {
5959 const issuer = await Issuer . discover ( APPID_OAUTH_SERVER_URL ) // connect to oidc application
6060 const client = new issuer . Client ( { // Initialize issuer information
6161 client_id : APPID_CLIENT_ID ,
62- client_secret : APPID_SECRET
62+ client_secret : APPID_SECRET ,
63+ redirect_uris : [ APPID_APP_URL + '/redirect_uri' , 'http://sfs.4loeser.net/redirect_uri' , 'http://0.0.0.0:8081/redirect_uri' ]
6364 } ) ;
6465 const params = {
6566 redirect_uri : APPID_APP_URL + '/redirect_uri' ,
@@ -71,7 +72,7 @@ async function configureOIDC(req, res, next) {
7172 req . app . authClient = client ;
7273
7374 // Register oidc strategy with passport
74- passport . use ( 'oidc' , new Strategy ( { client, params } , ( tokenset , userinfo , done ) => {
75+ passport . use ( 'oidc' , new Strategy ( { client } , ( tokenset , userinfo , done ) => {
7576 return done ( null , userinfo ) ; // return user information
7677 } ) ) ;
7778
@@ -122,7 +123,7 @@ var cosUrlGenerator = new CloudObjectStorage.S3({
122123
123124// serialize and deserialize the user information
124125passport . serializeUser ( function ( user , done ) {
125- console . log ( "Got authenticated user" , JSON . stringify ( user ) ) ;
126+ // console.log("Got authenticated user", JSON.stringify(user));
126127 done ( null , {
127128 id : user [ "id" ] ,
128129 name : user [ "name" ] ,
@@ -139,13 +140,16 @@ app.use(configureOIDC);
139140
140141// default protected route /authtest
141142app . get ( '/authtest' , ( req , res , next ) => {
142- passport . authenticate ( 'oidc' ) ( req , res , next ) ;
143+ passport . authenticate ( 'oidc' , {
144+ redirect_uri : `http://${ req . headers . host } /redirect_uri` ,
145+ } ) ( req , res , next ) ;
143146} ) ;
144147
145148// callback for the OpenID Connect identity provider
146149// in the case of an error go back to authentication
147150app . get ( '/redirect_uri' , ( req , res , next ) => {
148151 passport . authenticate ( 'oidc' , {
152+ redirect_uri : `http://${ req . headers . host } /redirect_uri` ,
149153 successRedirect : '/' ,
150154 failureRedirect : '/authtest'
151155 } ) ( req , res , next ) ;
0 commit comments