Open torrin47 opened 6 years ago
@torrin47 we've initially implemented using the REST API of the authentication service and we didn't get much more than the token and the username. Using ESRI libs, we get a bit further and are able to determine the user's full name as well as:
role: "org_publisher"
roleId: "jmc1ObdWfBTH6NAN"
I believe these indicate the user's role on the ArcGIS Online which most likely is unaware of the user's role in Geoportal Server. I could be wrong though, is there some mechanism that syncs or otherwise makes this info from EDG available to the EPA GeoPlatform?
If the answer is no, then I can imagine two alternatives: 1- We can make a call to EDG with the user's token to determine if the user is an EDG admin or publisher. We may need to erect a service for this if no API is readily available on the EDG side for this. 2- The services we will build to load/save a record from/to EDG can perform the check at that time. Somewhat less than ideal as the user won't know that they can actually load/save until attempting to do so.
Preference?
You're correct that the role and roleId are specific to ArcGIS Online and aren't related to EDG functionality. EDG permissions are controlled entirely by "group" membership - and I'm guessing that if you are receiving the role for the user, you also see the user's groups? The groups listed above are the relevant ones - there are two master groups - publisher and admin - and then all the individual organizational groups. The EDG allows a user to log in and then makes a server-side call for the user details and compares group membership against the list we embed in the config file. What I've never investigated is whether there's an API on the EDG side that we can use to check whether a logged in user is recognized as in the right GeoPlatform groups. It seems like the kind of thing we ought to be able to delegate to the EDG rather than have to check separately, but I've not seen any documentation on this front. I guess this is your alternative #1. Does that help?
Well, the thing is we are authenticating against EPA GeoPlatform / ArcGIS Online which is not aware of EDG groups. We can worry about this when we get to #26 and #27.
This ticket has now been deployed to dev. To facilitate this, dirty checking has also been implemented to prevent navigation confirmation prompts convoluting authentication related navigation such as:
There may be some edge cases around dirty checks so emphasis will need to be on QA @jzichichi @torrin47 .
@aergul @torrin47 this worked well for me; I tested with login, without login, etc. The prompts all worked as I would have expected.
Basic Login/logout works well. A couple of notes:
EPA Contact/sponsor addressed.
Login/logout flow is being implemented under #71
Internal EPA users will have the ability to login to the site using the same EPA GeoPlatform SAML authentication the EDG is migrating to.
Basic information is here - probably easiest to use libraries that are built into Esri's JavaScript API, though in theory the login is standards-based, and any OAuth login could work. https://developers.arcgis.com/javascript/latest/guide/secure-resources/
The essential info needed from authentication, in addition to simply having a valid GeoPlatform account, is group membership. Any GeoPlatform user should be permitted to use the internal version of the tool to author and save records (and submit to EDG team in a similar manner to extramurals?), but only members of the EDG Publishers or Administrators group would be permitted to write records to the EDG, and they would be limited to certain groups. These groups are stored in the EDG's config file listed below (I guess we'd need to keep this manually synchronized with the non-geo editor). These groupIDs aren't secret, so they can be included in the client-side JS code.