Deprecating AuthProvider in favor of Interceptor pattern #3167
Replies: 2 comments
-
|
What we gain:
|
Beta Was this translation helpful? Give feedback.
0 replies
-
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Before we release 1.0 there is a window of opportunity for us to fix the organic growth in this repo regarding authorizing requests.
Context
TDF Clientwas created to use AuthProvider for authorizing request. AuthProvider handles injecting the "Authorization" and the "DPoP" headers.PlatformClientwas added later on and usesConnect Web RPCwhich expects to use the Interceptor pattern for signing requests.What we had to do to make it work was create an AuthProviderInterceptor that takes the existing AuthProvider and returns an Interceptor that PlatformClient can use. This is working as expected.
Current State
TDF Clientworks only with AuthProviderPlatformClientworks with AuthProvider (with a gotcha) and Interceptors*The gotcha of using AuthProvider in PlatformClient:
TDFClient3 call
authProvider.updateClientPublicKey()internally modifying the AuthProvider and setting the signing keys.So
PlatformClientcan be used with AuthProvider but firstauthProvider.updateClientPublicKey()needs to be called and awaited.This is not documented nor explained.
There is a PR that addresses it to a degree: opentdf/web-sdk#883
Proposal
Lets unify the interfaces. Both
PlatformClientandTDF Clientto useInterceptorpattern. This will:What will it look like?
Is the
const authInterceptorto complex? Lets add a helper function calledauthTokenInterceptorThats it, OpenTDF client has authorization headers. Same for PlatformClient.
But what about DPoP?
A good question! A little bit more of research is needed for DPoP, but wouldn’t this be amazing?
Thats it, let the function handle creating the pair of signing keys. Yes, there is a little bit more to it, but from DX perspective, wouldn’t that be awesome?
Rounding Up
We haven’t released the stable 1.0 yet but we are very close. This is our window of opportunity to have it fixed for good
Beta Was this translation helpful? Give feedback.
All reactions