Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SLS-19] Rest client implementation for Identity Service #18

Merged
merged 38 commits into from
Apr 12, 2023
Merged
Show file tree
Hide file tree
Changes from 37 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
68bfd56
[SLS-19] Generated rest client with openAPI specification for retriev…
svariant Apr 6, 2023
d84bbaa
[SLS-19] Added error for oidc assertion in AssertionSimpleClient - no…
svariant Apr 6, 2023
4a002a0
[SLS-19] Updated openAPI generated client with response configuration
svariant Apr 11, 2023
c702499
[SLS-19] Defined skeleton getCertData - changed return type to List
svariant Apr 11, 2023
a04cb5c
[SLS-19] Written basic tests for getCertData
svariant Apr 11, 2023
ae5fedf
[SLS-19] Changed InputStream mapper from objectMapper to xmlMapper
svariant Apr 11, 2023
4defcd1
[SLS-19] Handled entities filtering by entityId - added exceptions
svariant Apr 12, 2023
24c2552
[SLS-19] Moved constant outside test method
svariant Apr 12, 2023
85985e2
[SLS-19] Fixed tag list sorting
svariant Apr 12, 2023
5ecda83
[SLS-19] Deleted unused class
svariant Apr 12, 2023
ed6b20c
[SLS-19] Test covered all IdpCertSimpleClient class methods
svariant Apr 12, 2023
8444619
[SLS-19] Removed TODOs
svariant Apr 12, 2023
27ca919
[SLS-19] Completed signature retrieving from idp certification - adde…
svariant Apr 12, 2023
90002ce
[SLS-19] Improved test constant instant - fixed tag list filtering
svariant Apr 12, 2023
79dddbc
[SLS-19] Improved tag list filtering - added test & configuration for…
svariant Apr 12, 2023
8cd1bbd
[SLS-19] Added configuration for api client for baseUri and endpoints…
svariant Apr 12, 2023
d7c7239
[SLS-19] Removed unused classes
svariant Apr 12, 2023
5b9c8cf
[SLS-19] Generated rest client with openAPI specification for retriev…
svariant Apr 6, 2023
541bd83
[SLS-19] Added error for oidc assertion in AssertionSimpleClient - no…
svariant Apr 6, 2023
496d824
[SLS-19] Updated openAPI generated client with response configuration
svariant Apr 11, 2023
65e29c3
[SLS-19] Defined skeleton getCertData - changed return type to List
svariant Apr 11, 2023
b29cd8b
[SLS-19] Written basic tests for getCertData
svariant Apr 11, 2023
11cf9c8
[SLS-19] Changed InputStream mapper from objectMapper to xmlMapper
svariant Apr 11, 2023
e07e489
[SLS-19] Handled entities filtering by entityId - added exceptions
svariant Apr 12, 2023
ddc5a6e
[SLS-19] Moved constant outside test method
svariant Apr 12, 2023
353aef1
[SLS-19] Fixed tag list sorting
svariant Apr 12, 2023
5012350
[SLS-19] Deleted unused class
svariant Apr 12, 2023
1bdbd7b
[SLS-19] Test covered all IdpCertSimpleClient class methods
svariant Apr 12, 2023
dc99984
[SLS-19] Removed TODOs
svariant Apr 12, 2023
ff16913
[SLS-19] Completed signature retrieving from idp certification - adde…
svariant Apr 12, 2023
4496f80
[SLS-19] Improved test constant instant - fixed tag list filtering
svariant Apr 12, 2023
65c885a
[SLS-19] Improved tag list filtering - added test & configuration for…
svariant Apr 12, 2023
ed9bb6c
[SLS-19] Added configuration for api client for baseUri and endpoints…
svariant Apr 12, 2023
77eb064
[SLS-19] Removed unused classes
svariant Apr 12, 2023
2826e2d
Merge remote-tracking branch 'origin/SLS-19' into SLS-19
svariant Apr 12, 2023
ff6eef2
[SLS-19] Removed unused classes from assertion-rest-client-native
svariant Apr 12, 2023
4eb159b
[SLS-19] Added uri & endpoint configuration for client used in Assert…
svariant Apr 12, 2023
b9183e4
Merge branch 'core-sprint-2' into SLS-19
alessio-cialini Apr 12, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions assertion-rest-client-native/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ dependencies {
// Use JUnit Jupiter for testing.
testImplementation 'org.junit.jupiter:junit-jupiter:5.9.2'
testImplementation 'org.assertj:assertj-core:3.24.2'

testImplementation 'org.mockito:mockito-core:5.2.0'
testImplementation 'org.mockito:mockito-junit-jupiter:5.2.0'
//Mockserver for testing api
testImplementation 'org.mock-server:mockserver-netty:5.15.0'
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
import it.pagopa.tech.lollipop.consumer.assertion.client.simple.internal.api.DefaultApi;
import it.pagopa.tech.lollipop.consumer.assertion.client.simple.internal.model.AssertionRef;
import it.pagopa.tech.lollipop.consumer.assertion.client.simple.internal.model.LCUserInfo;
import it.pagopa.tech.lollipop.consumer.assertion.client.simple.internal.model.OidcUserInfo;
import it.pagopa.tech.lollipop.consumer.assertion.client.simple.internal.model.SamlUserInfo;
import it.pagopa.tech.lollipop.consumer.exception.LollipopAssertionNotFoundException;
import it.pagopa.tech.lollipop.consumer.exception.OidcAssertionNotSupported;
import it.pagopa.tech.lollipop.consumer.model.SamlAssertion;
import javax.inject.Inject;

Expand All @@ -30,10 +32,11 @@ public AssertionSimpleClient(ApiClient client) {
* @param assertionRef Assertion unique identification
* @return the retrieved assertion or null if the assertion is not supported (not SAML)
* @throws LollipopAssertionNotFoundException if some error occurred in the request
* @throws OidcAssertionNotSupported if the assertion retrieved is a OIDC token
*/
@Override
public SamlAssertion getAssertion(String jwt, String assertionRef)
throws LollipopAssertionNotFoundException {
throws LollipopAssertionNotFoundException, OidcAssertionNotSupported {
AssertionRef ref = new AssertionRef(assertionRef);

LCUserInfo responseAssertion;
Expand All @@ -53,6 +56,9 @@ public SamlAssertion getAssertion(String jwt, String assertionRef)
response.setAssertionData(assertionData);
return response;
}
if (responseAssertion.getActualInstance().getClass().equals(OidcUserInfo.class)) {
throw new OidcAssertionNotSupported("OIDC Claims not supported yet.");
}

return null;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/* (C)2023 */
package it.pagopa.tech.lollipop.consumer.assertion.client.simple;

import lombok.Builder;
import lombok.Data;

@Data
@Builder
public class AssertionSimpleClientConfig {

@Builder.Default private String baseUri = "http://localhost:3000";

@Builder.Default private String assertionRequestEndpoint = "/assertions";
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,25 @@
import it.pagopa.tech.lollipop.consumer.assertion.client.AssertionClient;
import it.pagopa.tech.lollipop.consumer.assertion.client.AssertionClientProvider;
import it.pagopa.tech.lollipop.consumer.assertion.client.simple.internal.ApiClient;
import javax.inject.Inject;

/** Provider class for retrieving an instance of {@link AssertionSimpleClient} */
public class AssertionSimpleClientProvider implements AssertionClientProvider {

private final AssertionSimpleClientConfig assertionClientConfig;

@Inject
public AssertionSimpleClientProvider(AssertionSimpleClientConfig config) {
this.assertionClientConfig = config;
}

/**
* Provide an instance of {@link AssertionSimpleClient}
*
* @return {@link AssertionSimpleClient}
*/
@Override
public AssertionClient provideClient() {
return new AssertionSimpleClient(new ApiClient());
return new AssertionSimpleClient(new ApiClient(assertionClientConfig));
}
}
Loading