diff --git a/pom.xml b/pom.xml index f8eae094..a8382fa0 100644 --- a/pom.xml +++ b/pom.xml @@ -75,6 +75,12 @@ org.springframework.security spring-security-oauth2-jose + + + io.micrometer + micrometer-registry-prometheus + + diff --git a/src/main/java/br/com/zupacademy/gabriela/proposal/config/security/SecurityConfiguration.java b/src/main/java/br/com/zupacademy/gabriela/proposal/config/security/SecurityConfiguration.java index aa0b46bd..8945d38b 100644 --- a/src/main/java/br/com/zupacademy/gabriela/proposal/config/security/SecurityConfiguration.java +++ b/src/main/java/br/com/zupacademy/gabriela/proposal/config/security/SecurityConfiguration.java @@ -15,7 +15,8 @@ protected void configure(HttpSecurity http) throws Exception { authorizeRequests .antMatchers(HttpMethod.POST, "/api/proposals/*").hasAuthority("SCOPE_customer") .antMatchers(HttpMethod.GET, "/api/proposals/*").hasAuthority("SCOPE_customer") - .antMatchers(HttpMethod.POST, "/api/credit-cards/+*").hasAuthority("SCOPE_customer") + .antMatchers(HttpMethod.POST, "/api/credit-cards/**").hasAuthority("SCOPE_customer") + .antMatchers(HttpMethod.GET, "/actuator/**").permitAll() .anyRequest().authenticated() ) .oauth2ResourceServer(OAuth2ResourceServerConfigurer::jwt); diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index d8efe000..a0b37a01 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -26,3 +26,7 @@ creditCard.associateCardTask.frequency=${ASSOCIATE_CARD_TASK_FREQUENCY:10000} ## spring security resource server configuration spring.security.oauth2.resourceserver.jwt.issuer-uri=${KEYCLOAK_ISSUER_URI:http://localhost:18080/auth/realms/credit-card-proposals} spring.security.oauth2.resourceserver.jwt.jwk-set-uri=${KEYCLOAK_JWKS_URI:http://localhost:18080/auth/realms/credit-card-proposals/protocol/openid-connect/certs} + +#prometheus +management.endpoints.web.exposure.include=info,health,prometheus +management.endpoints.prometheus.enabled=true