You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
As we have more and more packages requiring authentication and authorization it makes sense to make it simpler for package authors to retrieve the current access token.
Currently, to retrieve the current access token, a package author needs to implement an extension, get the authprovider, then introduce a static api to retrieve the token from the extension in their nodes.
Let's just skip all that - this PR adds a method to DynamoServices: AuthServicesEvents.OnRequestAuthProvider() which DynamoModel handles by returning to the current auth provider if one exists.
It's implemented this way to avoid needing to add new references to DynamoServices and to enable ZT authors to avoid referencing DynamoCore.dll etc.
This should cover more use cases than the initial implementation.
This PR also starts multi targeting DynamoServices ( starts targeting net8 as well as netstd2) and adds this new target to the DynamoServices nuget package. This change was made so that we could use the Experimental attribute to guard the new API until we are satisfied with its design. For netstd2 builds we fallback to using the obsolete attribute which is less fitting and is ignorable by clients. Experimental attribute requires opt in.
github-actionsbot
changed the title
make access token accessible to all package authors using executesession
DYN-7925: make access token accessible to all package authors using executesession
Feb 28, 2025
@mjkkirschner I am still not sure how the access token is going to be used by authors. At the node implementation level ?
ExecutionSession is a static, but is it accessible from all the Node code paths an author might write code in ?
I would hope we can alter this later without having jumping through all the "breaking public APIs" hoops
@pinzart90 - yes, any node author can access an execute session, from ZT, python, or NodeModels.
Unfortunately @saintentropy showed me an example of the DX nodes where this implementation will not work - it's a UI node that requires auth before the graph is executed - so I will change this implementation to support that use case as well.
@pinzart90 - yes, any node author can access an execute session, from ZT, python, or NodeModels.
Unfortunately @saintentropy showed me an example of the DX nodes where this implementation will not work - it's a UI node that requires auth before the graph is executed - so I will change this implementation to support that use case as well.
So just to confirm, the token will be available to authors pre-graph execution, as opposed to what the PR description says (that you may implement that later)?
@pinzart90 - yes, any node author can access an execute session, from ZT, python, or NodeModels.
Unfortunately @saintentropy showed me an example of the DX nodes where this implementation will not work - it's a UI node that requires auth before the graph is executed - so I will change this implementation to support that use case as well.
So just to confirm, the token will be available to authors pre-graph execution, as opposed to what the PR description says (that you may implement that later)?
yes, that's correct @zeusongit - I will update the PR description when this is ready for another look.
this will require package authors to opt-in explicitly to using this experimental feature or they will get a compile error. I personally would like to see this approach taken more often to avoid the buildup of WIP APIs we cannot remove.
mjkkirschner
changed the title
DYN-7925: make access token accessible to all package authors using executesession
DYN-7925: make access token accessible to all package authors using static method
Mar 3, 2025
this will require package authors to opt-in explicitly to using this experimental feature or they will get a compile error. I personally would like to see this approach taken more often to avoid the buildup of WIP APIs we cannot remove.
@pinzart90@aparajit-pratap 😢 - so because the DynamoServices dll targets netstd2 and not net8 we cannot easily use the [experimental] attribute - Is there still a good reason that DynamoServices does not target net8? Something to do with LibG or package authors still targeting net48? Can we move everything up to net8 now?
e targets netstd2 and not net8 we cannot easily use the [experimental] attribute - Is there still a good reason that DynamoServices does not target net std 2? Something to do with
The only reason for netstd2 was to be compatible with net48 at the same time. If we no longer want to do releases of LibG for net48 or if we want to do multi targeting (which complicates the CICD process) then we can move it on up.
@mjkkirschner what version of DynamoServices (net8 or std) will be used by nuget restore when consumed in a net8 csproj?
Hopefully nuget knows to restore exact matches with the highest priority
@mjkkirschner what version of DynamoServices (net8 or std) will be used by nuget restore when consumed in a net8 csproj? Hopefully nuget knows to restore exact matches with the highest priority
I can verify, but it should be the highest matching framework target IIRC.
@mjkkirschner what version of DynamoServices (net8 or std) will be used by nuget restore when consumed in a net8 csproj? Hopefully nuget knows to restore exact matches with the highest priority
I can verify, but it should be the highest matching framework target IIRC.
confirmed @pinzart90 - it picks the right one based on the target of the referencing project.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
https://jira.autodesk.com/browse/DYN-7925
As we have more and more packages requiring authentication and authorization it makes sense to make it simpler for package authors to retrieve the current access token.
Currently, to retrieve the current access token, a package author needs to implement an extension, get the authprovider, then introduce a static api to retrieve the token from the extension in their nodes.
Let's just skip all that - this PR adds a method to DynamoServices:
AuthServicesEvents.OnRequestAuthProvider()
whichDynamoModel
handles by returning to the current auth provider if one exists.It's implemented this way to avoid needing to add new references to
DynamoServices
and to enable ZT authors to avoid referencing DynamoCore.dll etc.This should cover more use cases than the initial implementation.
This PR also starts multi targeting DynamoServices ( starts targeting net8 as well as netstd2) and adds this new target to the DynamoServices nuget package. This change was made so that we could use the
Experimental
attribute to guard the new API until we are satisfied with its design. For netstd2 builds we fallback to using theobsolete
attribute which is less fitting and is ignorable by clients. Experimental attribute requires opt in.Declarations
Check these if you believe they are true
*.resx
filesRelease Notes
Adds a static API for accessing current auth provider.
Reviewers