Hi Steve, thanks for digging up and improving the script. This is a super 
helpful utility.

One issue I noticed when using the script to collect endpoints of GPII running 
in the cloud based config (gpii.config.cloudBased.development.all.local) is, 
the collected endpoints 
<https://gist.github.com/cindyli/6f64589add846cb9cd6c415d9f6d21ac> don’t 
contain auth server endpoints that are registered directly onto 
"{kettle.server}.expressApp” without going through the regular 
“kettleServer.options.requestHandlers”.

To be clear, here are the detailed steps of how these auth server endpoints are 
registered:

1. the code 
<https://github.com/GPII/universal/blob/master/gpii/node_modules/flowManager/src/CloudBasedFlowManager.js#L113>
 that the auth server is hooked up as a subcomponent of the cloud based flow 
manager and grabs the express app created by the kettle server;
2. the code 
<https://github.com/GPII/universal/blob/master/gpii/node_modules/gpii-oauth2/gpii-oauth2-authz-server/src/AuthServer.js#L411>
 that adds auth server endpoints directly to the express app received from step 
1.

I’m thinking a more accurate way might be looking directly at the express app 
created by the kettle for endpoints as the endpoints defined via 
“kettleServer.options.requestHandlers” eventually will end up there too.

Looking forward to hearing thoughts from you and other people.

Cindy

> On Nov 25, 2017, at 10:49 PM, Steven Githens <[email protected]> wrote:
> 
> Hi all,
> 
> As we discussed a few weeks back, I went and dug up my script from a few 
> years ago to audit and list GPII endpoints, in this case the ones in the GPII 
> for security, documentation, etc.  https://issues.gpii.net/browse/GPII-2664
> 
> I also tweaked it a bit, to dump the actual live endpoints running in the 
> system.  But I wanted to check here on list to make sure that I was querying 
> all the kettle grades that would be necessary to pull these out.
> 
> The old version was here (it was looking through registered grades, but it 
> looks like the API has changed a bit):
> 
> https://gist.github.com/sgithens/ba1640625bdbb2c728eb
> 
> The current version that queries all the live components:
> 
> https://github.com/sgithens/lichen/blob/master/src/lichen.js#L43-L60
> https://github.com/sgithens/lichen/blob/master/README.md#inspecting-kettle-endpoints
> 
> Running this on a local universal (which may be a little stale) gives:
> 
> [
>    {
>        "typeName": "gpii.rawPreferencesServer",
>        "id": "9ien5j40-125",
>        "requestHandlers": {
>            "rawPreferencesGet": {
>                "route": "/rawPreferences/:userToken",
>                "method": "get",
>                "type": "gpii.rawPreferencesServer.get.handler"
>            },
>            "rawPreferencesPost": {
>                "route": "/rawPreferences",
>                "method": "post",
>                "type": "gpii.rawPreferencesServer.write.handler"
>            },
>            "rawPreferencesPut": {
>                "route": "/rawPreferences/:userToken",
>                "method": "put",
>                "type": "gpii.rawPreferencesServer.write.handler"
>            }
>        }
>    },
>    {
>        "typeName": "gpii.canopyMatchMaker",
>        "id": "9ien5j40-150",
>        "requestHandlers": {
>            "matchPost": {
>                "route": "/match",
>                "method": "post",
>                "type": "gpii.canopyMatchMaker.matchPost.handler"
>            }
>        }
>    },
>    {
>        "typeName": "gpii.flowManager",
>        "id": "9ien5j40-155",
>        "requestHandlers": {
>            "userLogin": {
>                "route": "/user/:userToken/login",
>                "method": "get",
>                "type": "gpii.flowManager.userLogin.handler",
>                "gradeNames": 
> "gpii.flowManager.userLogonHandling.matchMakingStateChangeHandler"
>            },
>            "userLogout": {
>                "route": "/user/:userToken/logout",
>                "method": "get",
>                "type": "gpii.flowManager.userLogout.handler"
>            },
>            "proximityTriggered": {
>                "route": "/user/:userToken/proximityTriggered",
>                "method": "get",
>                "type": "gpii.flowManager.proximityTrigger.handler",
>                "gradeNames": 
> "gpii.flowManager.userLogonHandling.matchMakingStateChangeHandler"
>            },
>            "getUserToken": {
>                "route": "/userToken",
>                "method": "get",
>                "type": "gpii.flowManager.getUserToken.handler"
>            },
>            "environmentChanged": {
>                "route": "/environmentChanged",
>                "method": "put",
>                "type": "gpii.contextManager.environmentChanged.handler"
>            },
>            "userSavePost": {
>                "route": "/user/preferences",
>                "method": "post",
>                "type": "gpii.flowManager.userSave.handler"
>            },
>            "userSavePut": {
>                "route": "/user/preferences/:userToken",
>                "method": "put",
>                "type": "gpii.flowManager.userSave.handler"
>            },
>            "userUpdate": {
>                "route": "/update",
>                "type": "gpii.flowManager.userUpdate.handler"
>            },
>            "browserChannel": {
>                "route": "/browserChannel",
>                "type": "gpii.flowManager.browserChannel.handler"
>            },
>            "pcpChannel": {
>                "route": "/pcpChannel",
>                "type": "gpii.pcpChannel.handler"
>            }
>        }
>    },
>    {
>        "typeName": "gpii.journal",
>        "id": "9ien5j40-217",
>        "requestHandlers": {
>            "restore": {
>                "route": "/journal/restore/:journalId",
>                "method": "get",
>                "type": "gpii.journal.restoreJournal.handler"
>            },
>            "journals": {
>                "route": "/journal/journals.html",
>                "method": "get",
>                "type": "gpii.journal.journals.handler"
>            }
>        }
>    },
>    {
>        "typeName": "gpii.preferencesServer",
>        "id": "9ien5j40-426",
>        "requestHandlers": {
>            "preferencesGet": {
>                "route": "/preferences/:userToken",
>                "method": "get",
>                "type": "gpii.preferencesServer.get.handler"
>            },
>            "preferencesPost": {
>                "route": "/preferences",
>                "method": "post",
>                "type": "gpii.preferencesServer.post.handler"
>            },
>            "preferencesPut": {
>                "route": "/preferences/:userToken",
>                "method": "put",
>                "type": "gpii.preferencesServer.put.handler"
>            },
>            "addPreferencesPost": {
>                "route": "/add-preferences",
>                "method": "post",
>                "type": "gpii.preferencesServer.add.post.handler"
>            }
>        }
>    },
>    {
>        "typeName": "gpii.deviceReporter",
>        "id": "9ien5j40-755",
>        "requestHandlers": {
>            "deviceGet": {
>                "route": "/device",
>                "type": "gpii.deviceReporter.handlers.get",
>                "method": "get"
>            }
>        }
>    }
> ]
> 
> Cheers,
> Steve
> _______________________________________________
> Architecture mailing list
> [email protected]
> https://lists.gpii.net/mailman/listinfo/architecture

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

_______________________________________________
Architecture mailing list
[email protected]
https://lists.gpii.net/mailman/listinfo/architecture

Reply via email to