diff --git a/pom.xml b/pom.xml index 8f04c04e20941c94b7810740b551d4d5cf229db3..10d9861a4bf1d40b33e55f5a9675d00f045a73e3 100644 --- a/pom.xml +++ b/pom.xml @@ -196,6 +196,13 @@ <scope>runtime</scope> </dependency> + <dependency> + <groupId>me.paulschwarz</groupId> + <artifactId>spring-dotenv</artifactId> + <version>4.0.0</version> + </dependency> + + </dependencies> <build> diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 35a3fe6f3753e6d33460e71d3a5f83d75b691203..9b8952e3e1f63f29ec58126023430b22ccad6930 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -9,3 +9,5 @@ spring.mail.password=${MAIL_PASSWORD} spring.mail.properties.mail.smtp.auth=true spring.mail.properties.mail.smtp.starttls.enable=true spring.mail.properties.mail.smtp.starttls.required=true + +JWT_SECRET_KEY={$JWT_SECRET_KEY} \ No newline at end of file diff --git a/src/test/java/com/safetypin/authentication/service/AuthenticationServiceTest.java b/src/test/java/com/safetypin/authentication/service/AuthenticationServiceTest.java index 4576bc5de8090eaa1dae194cd8692efad16dc9b4..11c3cadb5e33ff1dcc749ec532280d22eb2a9b47 100644 --- a/src/test/java/com/safetypin/authentication/service/AuthenticationServiceTest.java +++ b/src/test/java/com/safetypin/authentication/service/AuthenticationServiceTest.java @@ -11,12 +11,17 @@ import com.safetypin.authentication.repository.UserRepository; import io.jsonwebtoken.Claims; import io.jsonwebtoken.Jwts; import io.jsonwebtoken.security.Keys; +import jakarta.annotation.PostConstruct; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; +import org.springframework.boot.test.context.SpringBootTest; import org.springframework.security.crypto.password.PasswordEncoder; +import org.springframework.test.context.TestPropertySource; import java.security.Key; import java.time.LocalDate; @@ -44,7 +49,7 @@ class AuthenticationServiceTest { private AuthenticationService authenticationService; // registerUser tests - + @Test void testRegisterUser_UnderAge() { RegistrationRequest request = new RegistrationRequest(); diff --git a/src/test/resources/application-dev.properties b/src/test/resources/application-dev.properties index 9ce7ec693e8a8d50256ae29e4633de8395bdee65..143b39c94e8b4f211b8f97e1cef413481465c878 100644 --- a/src/test/resources/application-dev.properties +++ b/src/test/resources/application-dev.properties @@ -9,3 +9,4 @@ spring.jpa.database-platform=org.hibernate.dialect.H2Dialect spring.jpa.hibernate.ddl-auto=create-drop # (Optional) Enable SQL logging spring.jpa.show-sql=true +JWT_SECRET_KEY={$JWT_SECRET_KEY} \ No newline at end of file diff --git a/src/test/resources/application-test.properties b/src/test/resources/application-test.properties index 07779acab4e60edf864999d3b9de25a84c0ac557..24763b510cf6e49d3210b0a71f00527d8ab2edd8 100644 --- a/src/test/resources/application-test.properties +++ b/src/test/resources/application-test.properties @@ -4,4 +4,5 @@ spring.mail.username=username spring.mail.password=secret123 spring.mail.properties.mail.smtp.auth=true spring.mail.properties.mail.smtp.starttls.enable=false -spring.mail.properties.mail.smtp.starttls.required=false \ No newline at end of file +spring.mail.properties.mail.smtp.starttls.required=false +JWT_SECRET_KEY={$JWT_SECRET_KEY} \ No newline at end of file