Skip to content

Commit

Permalink
Corretto gestione degli accessi per le utenze anonime nelle API-Pagam…
Browse files Browse the repository at this point in the history
…ento servizi /avvisi, /pagamenti, /pendenze, /rpp.
  • Loading branch information
pintorig committed Dec 23, 2021
1 parent a6ad559 commit 317df16
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Feature: Ricerca pagamenti

Background:

* call read('classpath:utils/common-utils.feature')

Scenario: Ricerca pagamenti anonimo

* def pagamentiBaseurl = getGovPayApiBaseUrl({api: 'pagamento', versione: 'v1', autenticazione: 'public'})

Given url pagamentiBaseurl
And path '/avvisi'
When method get
Then status 403

Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Feature: Ricerca pagamenti

Background:

* call read('classpath:utils/common-utils.feature')

Scenario: Ricerca pagamenti anonimo

* def pagamentiBaseurl = getGovPayApiBaseUrl({api: 'pagamento', versione: 'v1', autenticazione: 'public'})

Given url pagamentiBaseurl
And path '/pendenze'
When method get
Then status 403

Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Feature: Ricerca pagamenti

Background:

* call read('classpath:utils/common-utils.feature')

Scenario: Ricerca pagamenti anonimo

* def pagamentiBaseurl = getGovPayApiBaseUrl({api: 'pagamento', versione: 'v2', autenticazione: 'public'})

Given url pagamentiBaseurl
And path '/avvisi'
When method get
Then status 403

Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Feature: Ricerca pagamenti

Background:

* call read('classpath:utils/common-utils.feature')

Scenario: Ricerca pagamenti anonimo

* def pagamentiBaseurl = getGovPayApiBaseUrl({api: 'pagamento', versione: 'v2', autenticazione: 'public'})

Given url pagamentiBaseurl
And path '/pendenze'
When method get
Then status 403

Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public Response pendenzeGET(Authentication user, UriInfo uriInfo, HttpHeaders ht
try{
this.log.info("Esecuzione " + methodName + " in corso...");
// autorizzazione sulla API
this.isAuthorized(user, Arrays.asList(TIPO_UTENZA.ANONIMO, TIPO_UTENZA.CITTADINO, TIPO_UTENZA.APPLICAZIONE), Arrays.asList(Servizio.API_PAGAMENTI), Arrays.asList(Diritti.LETTURA));
this.isAuthorized(user, Arrays.asList(TIPO_UTENZA.CITTADINO, TIPO_UTENZA.APPLICAZIONE), Arrays.asList(Servizio.API_PAGAMENTI), Arrays.asList(Diritti.LETTURA));

ValidatorFactory vf = ValidatorFactory.newInstance();
ValidatoreUtils.validaRisultatiPerPagina(vf, Costanti.PARAMETRO_RISULTATI_PER_PAGINA, risultatiPerPagina);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,12 @@
</b:bean>
<http auto-config="false" use-expressions="true" create-session="stateless" entry-point-ref="http403ForbiddenEntryPointPublic" pattern="/rs/public/v1/**">
<csrf disabled="true"/>
<intercept-url pattern="/rs/public/v1/avvisi" access="denyAll" />
<intercept-url pattern="/rs/public/v1/avvisi/**" access="isAnonymous()" method="GET" request-matcher-ref="avvisiGetRequestMatcherV1" />
<intercept-url pattern="/rs/public/v1/pagamenti" access="isAnonymous()" method="POST" request-matcher-ref="pagamentoPostRequestMatcherV1" />
<intercept-url pattern="/rs/public/v1/pagamenti" access="denyAll" />
<intercept-url pattern="/rs/public/v1/pagamenti/**" access="isAnonymous()" method="GET" />
<intercept-url pattern="/rs/public/v1/rpp" access="denyAll" />
<intercept-url pattern="/rs/public/v1/rpp/**" access="isAnonymous()" />
<intercept-url pattern="/rs/public/v1/**" access="denyAll" />
<custom-filter position="PRE_AUTH_FILTER" ref="preAuthFilterAnonymous" />
Expand All @@ -259,12 +262,16 @@
</b:bean>
<http auto-config="false" use-expressions="true" create-session="stateless" entry-point-ref="http403ForbiddenEntryPointPublic" pattern="/rs/public/v2/**">
<csrf disabled="true"/>
<intercept-url pattern="/rs/public/v2/avvisi" access="denyAll" />
<intercept-url pattern="/rs/public/v2/avvisi/**" access="isAnonymous()" method="GET" request-matcher-ref="avvisiGetRequestMatcherV2" />
<intercept-url pattern="/rs/public/v2/pagamenti" access="isAnonymous()" method="POST" request-matcher-ref="pagamentoPostRequestMatcherV2" />
<intercept-url pattern="/rs/public/v2/pagamenti" access="denyAll" />
<intercept-url pattern="/rs/public/v2/pagamenti/**" access="isAnonymous()" method="GET" />
<intercept-url pattern="/rs/public/v2/pendenze/**" access="isAnonymous()" method="POST" request-matcher-ref="pendenzaPostRequestMatcherV2" />
<intercept-url pattern="/rs/public/v2/pendenze" access="denyAll" />
<intercept-url pattern="/rs/public/v2/pendenze/**" access="isAnonymous()" method="GET" />
<intercept-url pattern="/rs/public/v2/pagamenti/**" access="isAnonymous()" method="GET" />
<intercept-url pattern="/rs/public/v2/domini/**" access="isAnonymous()" method="GET" />
<intercept-url pattern="/rs/public/v2/rpp" access="denyAll" />
<intercept-url pattern="/rs/public/v2/rpp/**" access="isAnonymous()" />
<intercept-url pattern="/rs/public/v2/**" access="denyAll" />
<custom-filter position="PRE_AUTH_FILTER" ref="preAuthFilterAnonymous" />
Expand Down

0 comments on commit 317df16

Please sign in to comment.