Skip to content
This repository has been archived by the owner on May 31, 2022. It is now read-only.

这段代码可以优化(this code below can be optimise) #1898

Open
lingpeiyong opened this issue Oct 19, 2020 · 1 comment
Open

这段代码可以优化(this code below can be optimise) #1898

lingpeiyong opened this issue Oct 19, 2020 · 1 comment

Comments

@lingpeiyong
Copy link

lingpeiyong commented Oct 19, 2020

image
代码位置(file location):/spring-security-oauth/spring-security-oauth2/src/main/java/org/springframework/security/oauth2/provider/request/DefaultOAuth2RequestFactory.java

  1. checkUserScopes 这个方法不需要clientDetails这个参数(the method of checkUserScopes is not need clientDetails parameter)
  2. extractScopes 这个方法里clientDetailsService.loadClientByClientId(clientId) 可以放在 if ((scopes == null || scopes.isEmpty())) 方法里,这样当判断为false时,可以减少一次数据库的查询操作。
    clientDetailsService.loadClientByClientId(clientId) in the method of "extractScopes" can be write in the body of " if ((scopes == null || scopes.isEmpty())) " , that can reduce one database query operation
@TDtianzhenjiu
Copy link

wether loadClientByClientId is going to query database is determined by ur loadClientByClientId method implication.
you can cache Details

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

No branches or pull requests

3 participants