-
Notifications
You must be signed in to change notification settings - Fork 119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: new UserSession tied to a non-federated ArcGIS Server instance #423
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for taking this on @jgravois!
The API you propose makes sense to me, as does the idea of piggy-backing on trusted servers.
My main suggestions is to add more comments to 'splain this so we don't forget later what this is all about.
this.trustedServers = {}; | ||
if (options.server) { | ||
this.trustedServers[options.server] = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I know why you're doing this, but probably a good idea to leave a comment here.
@@ -760,7 +790,8 @@ export class UserSession implements IAuthenticationManager { | |||
params: { | |||
username: this.username, | |||
password: this.password, | |||
expiration: this.tokenDuration | |||
expiration: this.tokenDuration, | |||
client: "referer" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we always want to send client=referer
? Do we need to add that to above call to generateToken()
too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it was only necessary in the case that i tweaked, but there's no harm in being consistent.
); | ||
} else { | ||
return request( | ||
`${response.owningSystemUrl}/sharing/rest/info`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add a comment here to 'splain what this case is?
* if its a stand-alone instance of ArcGIS Server that doesn't advertise | ||
* federation at all and the root url is recognized, use its built in token endpoint. | ||
*/ | ||
return new Promise((resolve, reject) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe just return Promise.resolve({ authInfo: response.authInfo });
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡
👶
i've added another small tweak to support the use case you mentioned. this is what needs to be provided to invoke it: const authentication = new UserSession({
server: "https://sampleserver6.arcgisonline.com/arcgis",
token: "SOSlV3v1wOOSN75azMS..",
tokenExpires: new Date(1545415669763)
}); to do:
(i'll wait on the first to do the second and third) |
@patrickarlt given that you chimed in on #422 but not this PR i'll assume you aren't fundamentally opposed to providing a mechanism to support making requests to non-federated, authenticated services. i know you're busy with https://developers.arcgis.com tasks so if i'm wrong even a quick "hold your horses, i haven't had time to look at this yet and i'd like to", sometime this week would be welcome. |
@jgravois I realized that you asked about this again ago but it all looks good to me. I figured at some point someone would ask for this, I just didn't want to do it. |
56d5a24
to
34acd33
Compare
thanks @patrickarlt! i've rebased and pushed up some more changes to ensure test coverage and tie up the remaining loose ends. i'm happy with this if @tomwayson is. |
… services AFFECTS PACKAGES: @esri/arcgis-rest-auth ISSUES CLOSED: #174
34acd33
to
fc2f06b
Compare
Codecov Report
@@ Coverage Diff @@
## master #423 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 94 94
Lines 1192 1202 +10
Branches 210 216 +6
=====================================
+ Hits 1192 1202 +10
Continue to review full report at Codecov.
|
the proposed tweak to
UserSession
would enable developers to build up a UI of their own for users to enter credentials and access secure content from unfederated instances of ArcGIS Server.AFFECTS PACKAGES:
@esri/arcgis-rest-auth
ISSUES CLOSED: #174