From cf060f66f0c9922ae653097975bee61473d56816 Mon Sep 17 00:00:00 2001 From: whywhathow Date: Tue, 21 Nov 2023 13:32:29 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20access=5Ftoken=20&=20refresh=5Ftoken=20?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E9=BB=98=E8=AE=A4`Base64StringKeyGenerator`?= =?UTF-8?q?=20=E7=94=9F=E6=88=90=20token.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../support/CustomeOAuth2AccessTokenGenerator.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/pig-auth/src/main/java/com/pig4cloud/pig/auth/support/CustomeOAuth2AccessTokenGenerator.java b/pig-auth/src/main/java/com/pig4cloud/pig/auth/support/CustomeOAuth2AccessTokenGenerator.java index 667f6da5..33bcf48d 100644 --- a/pig-auth/src/main/java/com/pig4cloud/pig/auth/support/CustomeOAuth2AccessTokenGenerator.java +++ b/pig-auth/src/main/java/com/pig4cloud/pig/auth/support/CustomeOAuth2AccessTokenGenerator.java @@ -1,6 +1,8 @@ package com.pig4cloud.pig.auth.support; import org.springframework.lang.Nullable; +import org.springframework.security.crypto.keygen.Base64StringKeyGenerator; +import org.springframework.security.crypto.keygen.StringKeyGenerator; import org.springframework.security.oauth2.core.ClaimAccessor; import org.springframework.security.oauth2.core.OAuth2AccessToken; import org.springframework.security.oauth2.core.endpoint.OAuth2ParameterNames; @@ -13,10 +15,7 @@ import org.springframework.util.CollectionUtils; import org.springframework.util.StringUtils; import java.time.Instant; -import java.util.Collections; -import java.util.Map; -import java.util.Set; -import java.util.UUID; +import java.util.*; /** * @author lengleng @@ -25,6 +24,9 @@ import java.util.UUID; public class CustomeOAuth2AccessTokenGenerator implements OAuth2TokenGenerator { private OAuth2TokenCustomizer accessTokenCustomizer; + private final StringKeyGenerator accessTokenGenerator = + new Base64StringKeyGenerator(Base64.getUrlEncoder().withoutPadding(), 96); + @Nullable @Override @@ -83,7 +85,7 @@ public class CustomeOAuth2AccessTokenGenerator implements OAuth2TokenGenerator