Skip to content

Commit

Permalink
Merge pull request #7 from davidorellana98/develop
Browse files Browse the repository at this point in the history
Change secret key in environment variables with property.
  • Loading branch information
davidorellana98 authored Dec 29, 2022
2 parents b63c38e + fb015c1 commit 0d1db4f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
public class OperationJwtImpl implements OperationJwt {

@Value("${KEY_SECRET}")
private String keySecret;
private String KEY_SECRET;

private final Integer MINUTES_JWT_EXPIRATION = 30;

Expand All @@ -25,7 +25,7 @@ public String generateJwt(User user, Calendar expirationDate) {
.claim("name", user.getName())
.setIssuedAt(new Date())
.setExpiration(expirationDate.getTime())
.signWith(SignatureAlgorithm.HS256, keySecret)
.signWith(SignatureAlgorithm.HS256, KEY_SECRET)
.compact();
}

Expand All @@ -46,7 +46,7 @@ public Boolean validateJwt(String jwt, User user) {
@Override
public Claims returnClaims(String jwt) {
return Jwts.parser()
.setSigningKey(keySecret)
.setSigningKey(KEY_SECRET)
.parseClaimsJws(jwt)
.getBody();
}
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ logging.level.org.springframework.data.mongodb.core.MongoTemplate=DEBUG
logging.level.org.springframework.data.mongodb.repository.Query=DEBUG
spring.data.mongodb.auto-index-creation=true
spring.mvc.pathmatch.matching-strategy=ant_path_matcher
KEY_SECRET=${KEY_SECRET}

0 comments on commit 0d1db4f

Please sign in to comment.