Skip to content
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

add DynamicTokenProvider. #239

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

vicenteyu
Copy link

多个应用,共享一套api 的TokenProvider机制。

Vicente Yu added 3 commits December 29, 2022 18:37
Signed-off-by: Vicente Yu <^@^>
Signed-off-by: Vicente.Yu <^@^>
Signed-off-by: Vicente.Yu <^@^>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IgnoreAttribute可以和WDynamicTokenAttribute合并,参考HeaderAttribute

/// </summary>
/// <param name="serviceProvider">服务提供者</param>
/// <returns></returns>
protected abstract Task<TokenResult?> RequestTokenAsync(IServiceProvider serviceProvider);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RequestTokenAsync可能需要携带identifier参数

/// <param name="serviceProvider">服务提供者</param>
/// <param name="refresh_token">刷新token</param>
/// <returns></returns>
protected abstract Task<TokenResult?> RefreshTokenAsync(IServiceProvider serviceProvider, string refresh_token);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RefreshTokenAsync可能需要携带identifier参数?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RefreshTokenAsync 按理不用,是以token换token。

@xljiulang
Copy link
Collaborator

这个接口的设计,与原体系偏离了,没有能够利用起ITokenProviderFactory的功能。
要实现一个TokenProvider支持多个以key来区分的token,只需要参考DI的Key模式,为ITokenProvider增加 void ClearToken(sting Key);Task<TokenResult> GetTokenAsync(string key);即可。

@vicenteyu
Copy link
Author

这个接口的设计,与原体系偏离了,没有能够利用起ITokenProviderFactory的功能。 要实现一个TokenProvider支持多个以key来区分的token,只需要参考DI的Key模式,为ITokenProvider增加 void ClearToken(sting Key);Task<TokenResult> GetTokenAsync(string key);即可。

懂了懂了,感谢!

Vicente.Yu added 9 commits November 22, 2023 18:22
Signed-off-by: Vicente.Yu <^@^>
Signed-off-by: Vicente.Yu <^@^>
Signed-off-by: Vicente.Yu <^@^>
Signed-off-by: Vicente.Yu <^@^>
Signed-off-by: Vicente.Yu <^@^>
Signed-off-by: Vicente.Yu <^@^>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants