By: Ben Cory user 25 May 2017 at 3:24 a.m. CDT

13 Responses
Ben Cory gravatar
I am attempting to add a new passport strategy to gluu. I have followed the guide: https://gluu.org/docs/ce/latest/authn-guide/passport/#setup-passportjs-with-gluu. I have chosen https://github.com/auth0/passport-azure-ad-oauth2 to get social logon with azure AD. At the end of the guide the last step is to add a button to the UI. I found the passport login page in the chroot: /opt/gluu/node/passport/webapp/passport/passportlogin.xhtml. I added the new button to the screen. Is this the correct place ? How do I get gluu to use the updated page ? I have cleared browser caches, restarted services and restarted the server.

By Mohib Zico staff 25 May 2017 at 5:49 a.m. CDT

Mohib Zico gravatar
Hello Ben, Yes. 'signinButton' div / provider class. BTW, we have plan to implement a new GUI for passport in future release. Screenshot attached. Check out that "+" button, administrator will be able to add any external provider easily.

By Ben Cory user 25 May 2017 at 8:32 a.m. CDT

Ben Cory gravatar
Thanks Mohib, I have changed the signinButton div in /opt/gluu/node/passport/webapp/passport/passportlogin.xhtml but the changes do not take affect. How do I get Gluu to use the page I have changed ?

By Mohib Zico staff 25 May 2017 at 8:33 a.m. CDT

Mohib Zico gravatar
I'll do a quick check and get back to you.

By Yuriy Movchan staff 06 Jul 2017 at 6:55 a.m. CDT

Yuriy Movchan gravatar
Hi, The folder for custom pages is `/opt/gluu/jetty/oxauth/custom/pages` Can you try to put xgtml passport pages into `/opt/gluu/jetty/oxauth/custom/pages/auth/passport`

By Ben Cory user 07 Jul 2017 at 10:50 a.m. CDT

Ben Cory gravatar
Hi Yuriy Thank you for your response. Moving the *.xhtml pages for passport to /opt/gluu/jetty/oxauth/custom/pages/auth/passport makes the image appear on passport login. The issue is the passport links do not work and the "Use subject to MIT LICENCE" link is rendered as text because the string is escaped. Inspecting the console in the browser dev tools It states that JQuery is not defined which is the cause as the javascript in the page is hooking up the click events for the passport buttons using JQuery.

By Arvind Tomar staff 10 Jul 2017 at 1:38 a.m. CDT

Arvind Tomar gravatar
Hi Ben, Thanks for getting us the issue about jQuery. Can you please replace the script tag for jquery with a CDN and then try again? ```<script type="text/javascript" src="https://code.jquery.com/jquery-1.11.3.min.js" integrity="sha256-7LkWEzqTdpEfELxcZZlS6wAx5Ff13zZ83lYO2/ujj7g=" crossorigin="anonymous"> </script> ``` We are working on the files path configuration and will update you shortly.

By Ben Cory user 10 Jul 2017 at 11:06 a.m. CDT

Ben Cory gravatar
Thanks Arvind, Using a CDN version fixes the issue and a github logon now works from a customised passportlogin.xhtml. There is an issue with "Use subject to MIT LICENCE" link. It is rendered as text because the anchor tags are escaped. The issue I have is when I click the added social logon button for azure ad oauth2 I get the message "Go back and register". I can see in the passport log an "unknown error" and then a url to hit the configured route on the Gluu server: "GET /passport/token HTTP/1.1\" 200 201 \"https://xxxx.com/oxauth/auth/passport/passport-login\" \"Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36\"","timestamp":"2017-07-10T15:44:27.847Z"} **{"level":"error","message":"Unknown Error: {}","**timestamp":"2017-07-10T15:44:27.862Z"} {"level":"info","message":"::ffff:127.0.0.1 - - [10/Jul/2017:15:44:27 +0000] \"GET **/passport/auth/azuread**/eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqd3QiOiIwMDc5OThmNC05ODQzLTRhMWMtODFhOS04NmM0ZWZjOGY3NzciLCJpYXQiOjE0OTk3MDE0NjcsImV4cCI6MTQ5OTcwMjkwN30.Fb4TJLN7VGzk3kKoIyrVGmz7CaxX_JP_ni42m2q_QSQ HTTP/1.1\" 302 74 \"https://xxxx.com/oxauth/auth/passport/passport-login\" \"Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36\"","timestamp":"2017-07-10T15:44:27.867Z"} {"level":"info","message":"::ffff:127.0.0.1 - - [10/Jul/2017:15:44:27 +0000] \"GET /passport/login HTTP/1.1\" 302 274 \"https://xxxx.com/oxauth/auth/passport/passport-login\" \"Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36\"","timestamp":"2017-07-10T15:44:27.874Z"} **I can't see anything else in the logs which indicate what the issue is.** **For a successful github auth I get: ** \"GET /passport/token HTTP/1.1\" 200 201 \"https://xxx.com/oxauth/auth/passport/passport-login\" \"Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36\"","timestamp":"2017-07-10T15:56:28.367Z"} {"level":"info","message":"::ffff:127.0.0.1 - - [10/Jul/2017:15:56:28 +0000] \"GET /passport/auth/github/eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqd3QiOiJiZDk0NzA1ZS05M2RhLTRlMDUtYmUyMi1lNWNmNzM3NTZkODUiLCJpYXQiOjE0OTk3MDIxODgsImV4cCI6MTQ5OTcwMzYyOH0.QrRItFtu7dvS_4Xaan8vkq-v9MJ7ECy3sz9MDlY2kcM HTTP/1.1\" 302 0 \"https://xxxx.com/oxauth/auth/passport/passport-login\" \"Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36\"","timestamp":"2017-07-10T15:56:28.381Z"} {"level":"info","message":"**User authenticated withgithubStrategy **with userid: 23654022","timestamp":"2017-07-10T15:56:29.484Z"} {"level":"info","message":"::ffff:127.0.0.1 - - [10/Jul/2017:15:56:29 +0000] \"GET /passport/auth/github/callback?code=6bb7982e860d1e4c2f11 HTTP/1.1\" 302 782 \"https://xxxx.com/oxauth/auth/passport/passport-login\" \"Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36\"","timestamp":"2017-07-10T15:56:29.486Z"} {"level":"info","message":"::ffff:127.0.0.1 - - [10/Jul/2017:15:57:01 +0000] \"GET /passport/token HTTP/1.1\" 200 201 \"https://xxxx.com/oxauth/auth/passport/passport-login\" \"Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36\"","timestamp":"2017-07-10T15:57:01.227Z"} {"level":"info","message":"::ffff:127.0.0.1 - - [10/Jul/2017:15:57:01 +0000] \"GET /passport/auth/github/eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqd3QiOiI4OWU4ZTQwZi01ZWIyLTQ3NjItODkzZC1mYzE0NjQ1YWMwZjEiLCJpYXQiOjE0OTk3MDIyMjEsImV4cCI6MTQ5OTcwMzY2MX0.ucy9nzUyNVSOyO0OPmp14LCq3GKm9v_7Up1bq1tTxHg HTTP/1.1\" 302 0 \"https://xxxx.com/oxauth/auth/passport/passport-login\" \"Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36\"","timestamp":"2017-07-10T15:57:01.238Z"} {"level":"info","message":"User authenticated withgithubStrategy with userid: 23654022","timestamp":"2017-07-10T15:57:02.301Z"} {"level":"info","message":"::ffff:127.0.0.1 - - [10/Jul/2017:15:57:02 +0000] \"GET /passport/auth/github/callback?code=793e30c9351101ed7d8a HTTP/1.1\" 302 782 \"https://xxxx.com/oxauth/auth/passport/passport-login\" \"Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36\"","timestamp":"2017-07-10T15:57:02.303Z"}

By Arvind Tomar staff 12 Jul 2017 at midnight CDT

Arvind Tomar gravatar
Hi Ben, Can you please pass in the Azure strategy configuration and the routes that you defined? I'll try adding it and will work on the issue. Please also give the package name that you have used for Azure. Thanks.

By Ben Cory user 12 Jul 2017 at 5:38 a.m. CDT

Ben Cory gravatar
Thanks Arvind, I have shared a link to a drop box folder which has the strategy js file, index and configureStrategies files. [Drop Box link for strategy config files](https://www.dropbox.com/sh/ipvgw7c9avjoury/AADPI5BjS0Hz6iGWvfjXPvDya?dl=0) I have called the strategy azuread. The second link is to the passport strategy I used : passport-azure-ad-oauth2 [Passport strategy installed](https://github.com/auth0/passport-azure-ad-oauth2) Let me know if you need anything else.

By Arvind Tomar staff 12 Jul 2017 at 6:22 a.m. CDT

Arvind Tomar gravatar
Thanks Ben, This will be all for now. I'll check and let you know the results.

By William Lowe user 28 Jul 2017 at 9:06 a.m. CDT

William Lowe gravatar
Hi Ben, I was just chatting with Arvind about status. I guess we don't have an azure account to test this with at the moment. I'm going to close this out for now. Thanks, Will

By Ben Cory user 28 Jul 2017 at 10:02 a.m. CDT

Ben Cory gravatar
Hi Will, I have a dev test Azure AD. I could register your gluu server as an app in my test Azure AD and provide you with ClientID and secret for a couple of days next week if that helps to investigate the issue. Regards, Ben

By William Lowe user 28 Jul 2017 at 10:05 a.m. CDT

William Lowe gravatar
Hey Ben, Thanks for the response. This is something we would definitely be interested in taking up, but is outside the scope of free community support. If you guys decide to proceed with a support contract we could allocate the resources necessary to investigate further. Thanks, Will