Skip to content

oauth2.0认证服务器, 相同客户端id相同账号进行登录, 登录两次, 会把第一次的替换掉, 支持同时保的留配置吗 #724

@ClearSeve

Description

@ClearSeve

oauth2.0认证服务器, 相同客户端id相同账号进行登录, 登录两次, 会把第一次的替换掉, 支持同时保的留配置吗

Activity

ClearSeve

ClearSeve commented on Jan 5, 2025

@ClearSeve
Author

相关问题的这几个都有配置, 不同客户端相同账号是可以各自保留的.
config.setIsConcurrent(true);
config.setIsShare(false);
config.setMaxLoginCount(-1);

mostcool

mostcool commented on Jan 13, 2025

@mostcool

请问你通过以上配置达到目的了吗?我测试了一下,貌似还是不行,一样会被替换掉呢。

ClearSeve

ClearSeve commented on Jan 13, 2025

@ClearSeve
Author

请问你通过以上配置达到目的了吗?我测试了一下,貌似还是不行,一样会被替换掉呢。

这个框架目前还不支持, 配置无法实现

added a commit that references this issue on May 12, 2025
f1089f6
mostcool

mostcool commented on May 19, 2025

@mostcool

这样修改后,同一客户端每次都会获取到一个新的token吗?

ytk929

ytk929 commented on Jun 4, 2025

@ytk929

@click33 更新后,每次请求都会有一个新的token,老的不会被覆盖掉,tokenValue变为了list。想问下clientId如果已经申请到token了就返回原来的token会有问题吗?在之前的版本我是通过复制出来一份SaOAuth2DataGenerateImpl,
`@Override
public ClientTokenModel generateClientToken(String clientId, List scopes) {
SaOAuth2Dao dao = SaOAuth2Manager.getDao();

ClientTokenModel oldCt = dao.getClientToken(dao.getClientTokenValue(clientId));
if (oldCt != null) {
    return oldCt;
}

SaClientModel cm = SaOAuth2Manager.getDataLoader().getClientModelNotNull(clientId);

// 生成新 Client-Token
String clientTokenValue = SaOAuth2Strategy.instance.createClientToken.execute(clientId, scopes);
ClientTokenModel ct = new ClientTokenModel(clientTokenValue, clientId, scopes);
ct.tokenType = SaOAuth2Consts.TokenType.bearer;
ct.expiresTime = System.currentTimeMillis() + (cm.getClientTokenTimeout() * 1000);
ct.extraData = new LinkedHashMap<>();
SaOAuth2Strategy.instance.workClientTokenByScope.accept(ct);

// 保存新Client-Token
dao.saveClientToken(ct);
dao.saveClientTokenIndex(ct);

return ct;

}`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @mostcool@ClearSeve@ytk929

        Issue actions

          oauth2.0认证服务器, 相同客户端id相同账号进行登录, 登录两次, 会把第一次的替换掉, 支持同时保的留配置吗 · Issue #724 · dromara/Sa-Token