Skip to content

Commit 9adce08

Browse files
author
王亮
committed
token certificate
1 parent 2d15ce1 commit 9adce08

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

springboot-starter-security-jwt/src/main/java/com/codingapi/springboot/security/filter/MyAuthenticationFilter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ protected void doFilterInternal(HttpServletRequest request, HttpServletResponse
4343

4444
Token token = jwt.parser(sign);
4545
if(token.canRestToken()){
46-
Token newSign = jwt.create(token.getUsername(),token.getPassword(),token.getAuthorities());
46+
Token newSign = jwt.create(token.getUsername(),token.getCertificate(),token.getAuthorities());
4747
log.info("reset token ");
4848
response.setHeader(TOKEN_KEY,newSign.getToken());
4949
}

springboot-starter-security-jwt/src/main/java/com/codingapi/springboot/security/jwt/Token.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
public class Token implements JsonSerializable {
2020

2121
private String username;
22-
private String password;
22+
private String certificate;
2323
private String token;
2424
private List<String> authorities;
2525
private long expireTime;
@@ -29,9 +29,9 @@ public class Token implements JsonSerializable {
2929
public Token() {
3030
}
3131

32-
public Token(String username,String password,List<String> authorities, int expireValue, int remindValue) throws IOException {
32+
public Token(String username, String certificate, List<String> authorities, int expireValue, int remindValue) throws IOException {
3333
this.username = username;
34-
this.password = AESUtils.getInstance().encodeToBase64(password);
34+
this.certificate = AESUtils.getInstance().encodeToBase64(certificate);
3535
this.authorities = authorities;
3636
this.expireTime = System.currentTimeMillis()+expireValue;
3737
this.remindTime = System.currentTimeMillis()+remindValue;
@@ -49,13 +49,13 @@ public boolean isExpire(){
4949
}
5050

5151

52-
public String getPassword(){
53-
return password;
52+
public String getCertificate(){
53+
return certificate;
5454
}
5555

5656
@Transient
5757
public String getDecodePassword() throws IOException {
58-
return AESUtils.getInstance().decodeToBase64(password);
58+
return AESUtils.getInstance().decodeToBase64(certificate);
5959
}
6060

6161
public boolean canRestToken() {
@@ -69,7 +69,7 @@ public UsernamePasswordAuthenticationToken getAuthenticationToken(){
6969
for(String authority:authorities){
7070
simpleGrantedAuthorities.add(new SimpleGrantedAuthority(authority));
7171
}
72-
return new UsernamePasswordAuthenticationToken(this,password,simpleGrantedAuthorities);
72+
return new UsernamePasswordAuthenticationToken(this, certificate,simpleGrantedAuthorities);
7373
}
7474

7575

0 commit comments

Comments
 (0)