diff --git a/src/main/java/com/davidorellana/bookingsystemrestapi/auth/security/jwt/OperationJwtImpl.java b/src/main/java/com/davidorellana/bookingsystemrestapi/auth/security/jwt/OperationJwtImpl.java index 0a0a91b..0f423fb 100644 --- a/src/main/java/com/davidorellana/bookingsystemrestapi/auth/security/jwt/OperationJwtImpl.java +++ b/src/main/java/com/davidorellana/bookingsystemrestapi/auth/security/jwt/OperationJwtImpl.java @@ -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; @@ -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(); } @@ -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(); } diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 5b300c2..0069e22 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -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}