BUGFIX:无法通过谷歌登录/教育管理员无法查看design使用频次
This commit is contained in:
@@ -64,7 +64,7 @@ public class ConvenientInquiryController {
|
||||
@GetMapping("/getDesignStatistic")
|
||||
public Response<List<UserDesignStatisticDTO>> getDesignStatistic(@RequestParam(required = false) String startTime, @RequestParam(required = false) String endTime,
|
||||
@RequestParam(required = false) List<Long> ids, @RequestParam(required = false) String email) {
|
||||
Long accountId = UserContext.getUserHolder().getId();
|
||||
/*Long accountId = UserContext.getUserHolder().getId();
|
||||
String userEmail = accountService.getById(accountId).getUserEmail();
|
||||
if (accountId.equals(31L) || accountId.equals(87L) || accountId.equals(83L)
|
||||
|| accountId.equals(6L) || accountId.equals(4L) || accountId.equals(73L)
|
||||
@@ -85,7 +85,8 @@ public class ConvenientInquiryController {
|
||||
return Response.success(designStatistic);
|
||||
} else {
|
||||
return Response.fail("Sorry, you don't have permission");
|
||||
}
|
||||
}*/
|
||||
return Response.success(convenientInquiryService.getDesignStatistic(startTime, endTime, ids, email));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -121,6 +121,16 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
@Value("${minio.bucketName.users}")
|
||||
private String userBucket;
|
||||
|
||||
@Value("${google.client.id}")
|
||||
private String googleClientId;
|
||||
|
||||
@Value("${google.client.secret}")
|
||||
private String googleClientSecret;
|
||||
|
||||
@Value("${google.redirect.uri}")
|
||||
private String googleRedirectUri;
|
||||
|
||||
|
||||
@Resource
|
||||
private RedisUtil redisUtil;
|
||||
|
||||
@@ -2148,12 +2158,9 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
private static final String TOKEN_URL = "https://oauth2.googleapis.com/token";
|
||||
private static final String USER_INFO_URL = "https://www.googleapis.com/oauth2/v3/userinfo";
|
||||
// private static final String CLIENT_ID = "194770296147-njd68pm7tnapgonkj2h48mhf63n15n3f.apps.googleusercontent.com";
|
||||
private static final String CLIENT_ID = "29310152396-nnsd3h533fld665oguu8ovrt1nukmt46.apps.googleusercontent.com";
|
||||
// private static final String CLIENT_SECRET = "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";
|
||||
private static final String CLIENT_SECRET = "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";
|
||||
// private static final String REDIRECT_URI = "https://0551-117-143-125-51.ngrok-free.app/api/third/party/auth/google_callback";
|
||||
// private static final String REDIRECT_URI = "https://develop.api.aida.com.hk/api/third/party/auth/google_callback";
|
||||
private static final String REDIRECT_URI = "https://www.aida.com.hk/api/third/party/auth/google_callback";
|
||||
|
||||
public GoogleUser getGoogleUserFromCode(String code) {
|
||||
// Step 1: Exchange code for access_token
|
||||
@@ -2167,9 +2174,9 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
private String getAccessToken(String code) {
|
||||
RestTemplate restTemplate = new RestTemplate();
|
||||
Map<String, String> params = new HashMap<>();
|
||||
params.put("client_id", CLIENT_ID);
|
||||
params.put("client_secret", CLIENT_SECRET);
|
||||
params.put("redirect_uri", REDIRECT_URI);
|
||||
params.put("client_id", googleClientId);
|
||||
params.put("client_secret", googleClientSecret);
|
||||
params.put("redirect_uri", googleRedirectUri);
|
||||
params.put("grant_type", "authorization_code");
|
||||
params.put("code", code);
|
||||
|
||||
@@ -2749,7 +2756,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
GoogleIdTokenVerifier verifier = new GoogleIdTokenVerifier.Builder(
|
||||
new NetHttpTransport(),
|
||||
JacksonFactory.getDefaultInstance())
|
||||
.setAudience(Collections.singletonList(CLIENT_ID))
|
||||
.setAudience(Collections.singletonList(googleClientId))
|
||||
.build();
|
||||
|
||||
// 验证并解析 ID Token
|
||||
@@ -3084,7 +3091,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
GoogleIdTokenVerifier verifier = new GoogleIdTokenVerifier.Builder(
|
||||
new NetHttpTransport(),
|
||||
JacksonFactory.getDefaultInstance())
|
||||
.setAudience(Collections.singletonList(CLIENT_ID))
|
||||
.setAudience(Collections.singletonList(googleClientId))
|
||||
.build();
|
||||
|
||||
// 验证并解析 ID Token
|
||||
|
||||
Reference in New Issue
Block a user