diff --git a/core/persistence-jpa-json/src/test/resources/domains/MasterContent.xml b/core/persistence-jpa-json/src/test/resources/domains/MasterContent.xml
index 4bcf49aaf5..3c123e6b98 100644
--- a/core/persistence-jpa-json/src/test/resources/domains/MasterContent.xml
+++ b/core/persistence-jpa-json/src/test/resources/domains/MasterContent.xml
@@ -58,14 +58,14 @@ under the License.
+ jsonConf='{"_class":"org.apache.syncope.common.lib.policy.DefaultAttrReleasePolicyConf","releaseAttrs":{},"allowedAttrs":[],"excludedAttrs":[],"includeOnlyAttrs":[],"principalIdAttr":null,"principalAttrRepoConf":{"mergingStrategy":"MULTIVALUED","ignoreResolvedAttributes":false,"expiration":0,"timeUnit":"HOURS","attrRepos":[]}}'/>
+ jsonConf='{"_class":"org.apache.syncope.common.lib.policy.DefaultAttrReleasePolicyConf","releaseAttrs":{},"allowedAttrs":["cn","givenName","uid"],"excludedAttrs":[],"includeOnlyAttrs":[],"principalIdAttr":null,"principalAttrRepoConf":{"mergingStrategy":"MULTIVALUED","ignoreResolvedAttributes":false,"expiration":0,"timeUnit":"HOURS","attrRepos":[]}}'/>
+ items='[{"intAttrName":"mail","extAttrName":"email","connObjectKey":false,"password":false,"mandatoryCondition":"false","purpose":"NONE","propagationJEXLTransformer":null,"pullJEXLTransformer":null,"transformers":[]},{"intAttrName":"givenName","extAttrName":"given_name","connObjectKey":false,"password":false,"mandatoryCondition":"false","purpose":"NONE","propagationJEXLTransformer":null,"pullJEXLTransformer":null,"transformers":[]},{"intAttrName":"sn","extAttrName":"family_name","connObjectKey":false,"password":false,"mandatoryCondition":"false","purpose":"NONE","propagationJEXLTransformer":null,"pullJEXLTransformer":null,"transformers":[]},{"intAttrName":"cn","extAttrName":"name","connObjectKey":false,"password":false,"mandatoryCondition":"false","purpose":"NONE","propagationJEXLTransformer":null,"pullJEXLTransformer":null,"transformers":[]}]'/>
+ jsonConf='{"_class":"org.apache.syncope.common.lib.policy.DefaultAttrReleasePolicyConf","releaseAttrs":{},"allowedAttrs":[],"excludedAttrs":[],"includeOnlyAttrs":[],"principalIdAttr":null,"principalAttrRepoConf":{"mergingStrategy":"MULTIVALUED","ignoreResolvedAttributes":false,"expiration":0,"timeUnit":"HOURS","attrRepos":[]}}'/>
+ jsonConf='{"_class":"org.apache.syncope.common.lib.policy.DefaultAttrReleasePolicyConf","releaseAttrs":{},"allowedAttrs":["cn","givenName","uid"],"excludedAttrs":[],"includeOnlyAttrs":[],"principalIdAttr":null,"principalAttrRepoConf":{"mergingStrategy":"MULTIVALUED","ignoreResolvedAttributes":false,"expiration":0,"timeUnit":"HOURS","attrRepos":[]}}'/>
+ items='[{"intAttrName":"mail","extAttrName":"email","connObjectKey":false,"password":false,"mandatoryCondition":"false","purpose":"NONE","propagationJEXLTransformer":null,"pullJEXLTransformer":null,"transformers":[]},{"intAttrName":"givenName","extAttrName":"given_name","connObjectKey":false,"password":false,"mandatoryCondition":"false","purpose":"NONE","propagationJEXLTransformer":null,"pullJEXLTransformer":null,"transformers":[]},{"intAttrName":"sn","extAttrName":"family_name","connObjectKey":false,"password":false,"mandatoryCondition":"false","purpose":"NONE","propagationJEXLTransformer":null,"pullJEXLTransformer":null,"transformers":[]},{"intAttrName":"cn","extAttrName":"name","connObjectKey":false,"password":false,"mandatoryCondition":"false","purpose":"NONE","propagationJEXLTransformer":null,"pullJEXLTransformer":null,"transformers":[]}]'/>
newInstance(final String id,
this.addNewItemPanelBuilder(new OIDCProviderWizardBuilder(
this, new OIDCC4UIProviderTO(), implementationRestClient, restClient, pageRef), true);
- MetaDataRoleAuthorizationStrategy.authorize(addAjaxLink, RENDER, OIDC4UIEntitlement.OP_CREATE);
+ MetaDataRoleAuthorizationStrategy.authorize(addAjaxLink, RENDER, OIDCC4UIEntitlement.OP_CREATE);
modal.size(Modal.Size.Large);
@@ -183,7 +183,7 @@ public void onClick(final AjaxRequestTarget target, final OIDCC4UIProviderTO ign
new AjaxWizard.EditItemActionEvent<>(object, target));
modal.header(Model.of(StringUtils.capitalize(("Edit " + object.getName()))));
}
- }, ActionLink.ActionType.EDIT, OIDC4UIEntitlement.OP_UPDATE);
+ }, ActionLink.ActionType.EDIT, OIDCC4UIEntitlement.OP_UPDATE);
panel.add(new ActionLink<>() {
@@ -217,7 +217,7 @@ protected Serializable onApplyInternal(final AnyWrapper modelObject) {
target.add(templateModal);
}
- }, ActionLink.ActionType.TEMPLATE, OIDC4UIEntitlement.OP_UPDATE);
+ }, ActionLink.ActionType.TEMPLATE, OIDCC4UIEntitlement.OP_UPDATE);
panel.add(new ActionLink<>() {
@@ -235,7 +235,7 @@ public void onClick(final AjaxRequestTarget target, final OIDCC4UIProviderTO ign
}
((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target);
}
- }, ActionLink.ActionType.DELETE, OIDC4UIEntitlement.OP_DELETE, true);
+ }, ActionLink.ActionType.DELETE, OIDCC4UIEntitlement.OP_DELETE, true);
return panel;
}
diff --git a/ext/oidcc4ui/common-lib/src/main/java/org/apache/syncope/common/lib/types/OIDC4UIEntitlement.java b/ext/oidcc4ui/common-lib/src/main/java/org/apache/syncope/common/lib/types/OIDCC4UIEntitlement.java
similarity index 91%
rename from ext/oidcc4ui/common-lib/src/main/java/org/apache/syncope/common/lib/types/OIDC4UIEntitlement.java
rename to ext/oidcc4ui/common-lib/src/main/java/org/apache/syncope/common/lib/types/OIDCC4UIEntitlement.java
index 3f6a0a98df..8b559ffd07 100644
--- a/ext/oidcc4ui/common-lib/src/main/java/org/apache/syncope/common/lib/types/OIDC4UIEntitlement.java
+++ b/ext/oidcc4ui/common-lib/src/main/java/org/apache/syncope/common/lib/types/OIDCC4UIEntitlement.java
@@ -24,7 +24,7 @@
import java.util.Set;
import java.util.TreeSet;
-public final class OIDC4UIEntitlement {
+public final class OIDCC4UIEntitlement {
public static final String OP_READ = "OP_READ";
@@ -38,7 +38,7 @@ public final class OIDC4UIEntitlement {
static {
Set values = new TreeSet<>();
- for (Field field : OIDC4UIEntitlement.class.getDeclaredFields()) {
+ for (Field field : OIDCC4UIEntitlement.class.getDeclaredFields()) {
if (Modifier.isStatic(field.getModifiers()) && String.class.equals(field.getType())) {
values.add(field.getName());
}
@@ -50,7 +50,7 @@ public static Set values() {
return VALUES;
}
- private OIDC4UIEntitlement() {
+ private OIDCC4UIEntitlement() {
// private constructor for static utility class
}
}
diff --git a/ext/oidcc4ui/logic/src/main/java/org/apache/syncope/core/logic/OIDCC4UILogic.java b/ext/oidcc4ui/logic/src/main/java/org/apache/syncope/core/logic/OIDCC4UILogic.java
index 29578eb994..2daa162e13 100644
--- a/ext/oidcc4ui/logic/src/main/java/org/apache/syncope/core/logic/OIDCC4UILogic.java
+++ b/ext/oidcc4ui/logic/src/main/java/org/apache/syncope/core/logic/OIDCC4UILogic.java
@@ -41,7 +41,7 @@
import org.apache.syncope.common.lib.types.ClientExceptionType;
import org.apache.syncope.common.lib.types.IdRepoEntitlement;
import org.apache.syncope.core.logic.oidc.NoOpSessionStore;
-import org.apache.syncope.core.logic.oidc.OIDC4UIContext;
+import org.apache.syncope.core.logic.oidc.OIDCC4UIContext;
import org.apache.syncope.core.logic.oidc.OIDCClientCache;
import org.apache.syncope.core.logic.oidc.OIDCUserManager;
import org.apache.syncope.core.persistence.api.dao.NotFoundException;
@@ -114,7 +114,7 @@ public OIDCRequest createLoginRequest(final String redirectURI, final String opN
// 2. create OIDCRequest
WithLocationAction action = oidcClient.getRedirectionAction(
- new CallContext(new OIDC4UIContext(), NoOpSessionStore.INSTANCE)).
+ new CallContext(new OIDCC4UIContext(), NoOpSessionStore.INSTANCE)).
map(WithLocationAction.class::cast).
orElseThrow(() -> {
SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.Unknown);
@@ -143,9 +143,8 @@ public OIDCLoginResponse login(final String redirectURI, final String authorizat
OidcCredentials credentials = new OidcCredentials();
credentials.setCode(new AuthorizationCode(authorizationCode));
- OIDC4UIContext ctx = new OIDC4UIContext();
-
- oidcClient.getAuthenticator().validate(new CallContext(ctx, NoOpSessionStore.INSTANCE), credentials);
+ oidcClient.getAuthenticator().validate(
+ new CallContext(new OIDCC4UIContext(), NoOpSessionStore.INSTANCE), credentials);
idToken = credentials.getIdToken().getJWTClaimsSet();
idTokenHint = credentials.getIdToken().serialize();
@@ -157,8 +156,8 @@ public OIDCLoginResponse login(final String redirectURI, final String authorizat
}
// 3. prepare the result
- OIDCLoginResponse loginResponse = new OIDCLoginResponse();
- loginResponse.setLogoutSupported(StringUtils.isNotBlank(op.getEndSessionEndpoint()));
+ OIDCLoginResponse loginResp = new OIDCLoginResponse();
+ loginResp.setLogoutSupported(StringUtils.isNotBlank(op.getEndSessionEndpoint()));
// 3a. find matching user (if any) and return the received attributes
String keyValue = idToken.getSubject();
@@ -171,16 +170,16 @@ public OIDCLoginResponse login(final String redirectURI, final String authorizat
orElse(null);
if (value != null) {
attrTO.getValues().add(value);
- loginResponse.getAttrs().add(attrTO);
+ loginResp.getAttrs().add(attrTO);
if (item.isConnObjectKey()) {
keyValue = value;
}
}
}
- List matchingUsers = keyValue == null
- ? List.of()
- : userManager.findMatchingUser(keyValue, op.getConnObjectKeyItem().get());
+ List matchingUsers = Optional.ofNullable(keyValue).
+ map(k -> userManager.findMatchingUser(k, op.getConnObjectKeyItem().get())).
+ orElse(List.of());
LOG.debug("Found {} matching users for {}", matchingUsers.size(), keyValue);
// 3b. not found: create or selfreg if configured
@@ -191,23 +190,23 @@ public OIDCLoginResponse login(final String redirectURI, final String authorizat
String defaultUsername = keyValue;
username = AuthContextUtils.callAsAdmin(AuthContextUtils.getDomain(),
- () -> userManager.create(op, loginResponse, defaultUsername));
+ () -> userManager.create(op, loginResp, defaultUsername));
} else if (op.isSelfRegUnmatching()) {
UserTO userTO = new UserTO();
- userManager.fill(op, loginResponse, userTO);
+ userManager.fill(op, loginResp, userTO);
- loginResponse.getAttrs().clear();
- loginResponse.getAttrs().addAll(userTO.getPlainAttrs());
+ loginResp.getAttrs().clear();
+ loginResp.getAttrs().addAll(userTO.getPlainAttrs());
if (StringUtils.isNotBlank(userTO.getUsername())) {
- loginResponse.setUsername(userTO.getUsername());
+ loginResp.setUsername(userTO.getUsername());
} else {
- loginResponse.setUsername(keyValue);
+ loginResp.setUsername(keyValue);
}
- loginResponse.setSelfReg(true);
+ loginResp.setSelfReg(true);
- return loginResponse;
+ return loginResp;
} else {
throw new NotFoundException(Optional.ofNullable(keyValue).
map(value -> "User matching the provided value " + value).
@@ -220,13 +219,13 @@ public OIDCLoginResponse login(final String redirectURI, final String authorizat
LOG.debug("About to update {} for {}", matchingUsers.get(0), keyValue);
username = AuthContextUtils.callAsAdmin(AuthContextUtils.getDomain(),
- () -> userManager.update(matchingUsers.get(0), op, loginResponse));
+ () -> userManager.update(matchingUsers.get(0), op, loginResp));
} else {
username = matchingUsers.get(0);
}
}
- loginResponse.setUsername(username);
+ loginResp.setUsername(username);
// 4. generate JWT for further access
Map claims = new HashMap<>();
@@ -236,18 +235,18 @@ public OIDCLoginResponse login(final String redirectURI, final String authorizat
byte[] authorities = null;
try {
authorities = ENCRYPTOR.encode(POJOHelper.serialize(
- authDataAccessor.getAuthorities(loginResponse.getUsername(), null)), CipherAlgorithm.AES).
+ authDataAccessor.getAuthorities(loginResp.getUsername(), null)), CipherAlgorithm.AES).
getBytes();
} catch (Exception e) {
LOG.error("Could not fetch authorities", e);
}
Pair accessTokenInfo =
- accessTokenDataBinder.create(loginResponse.getUsername(), claims, authorities, true);
- loginResponse.setAccessToken(accessTokenInfo.getLeft());
- loginResponse.setAccessTokenExpiryTime(accessTokenInfo.getRight());
+ accessTokenDataBinder.create(loginResp.getUsername(), claims, authorities, true);
+ loginResp.setAccessToken(accessTokenInfo.getLeft());
+ loginResp.setAccessTokenExpiryTime(accessTokenInfo.getRight());
- return loginResponse;
+ return loginResp;
}
@PreAuthorize("isAuthenticated() and not(hasRole('" + IdRepoEntitlement.ANONYMOUS + "'))")
@@ -274,7 +273,7 @@ public OIDCRequest createLogoutRequest(final String accessToken, final String re
profile.setIdTokenString((String) claimsSet.getClaim(JWT_CLAIM_ID_TOKEN));
WithLocationAction action = oidcClient.getLogoutAction(
- new CallContext(new OIDC4UIContext(), NoOpSessionStore.INSTANCE),
+ new CallContext(new OIDCC4UIContext(), NoOpSessionStore.INSTANCE),
profile,
redirectURI).
map(WithLocationAction.class::cast).
diff --git a/ext/oidcc4ui/logic/src/main/java/org/apache/syncope/core/logic/OIDCC4UIProviderLogic.java b/ext/oidcc4ui/logic/src/main/java/org/apache/syncope/core/logic/OIDCC4UIProviderLogic.java
index d933b0bd79..6bfcdd3e2b 100644
--- a/ext/oidcc4ui/logic/src/main/java/org/apache/syncope/core/logic/OIDCC4UIProviderLogic.java
+++ b/ext/oidcc4ui/logic/src/main/java/org/apache/syncope/core/logic/OIDCC4UIProviderLogic.java
@@ -29,7 +29,7 @@
import org.apache.syncope.common.lib.to.Item;
import org.apache.syncope.common.lib.to.OIDCC4UIProviderTO;
import org.apache.syncope.common.lib.types.ClientExceptionType;
-import org.apache.syncope.common.lib.types.OIDC4UIEntitlement;
+import org.apache.syncope.common.lib.types.OIDCC4UIEntitlement;
import org.apache.syncope.core.logic.oidc.OIDCClientCache;
import org.apache.syncope.core.persistence.api.dao.NotFoundException;
import org.apache.syncope.core.persistence.api.dao.OIDCC4UIProviderDAO;
@@ -60,7 +60,7 @@ public OIDCC4UIProviderLogic(
this.binder = binder;
}
- @PreAuthorize("hasRole('" + OIDC4UIEntitlement.OP_CREATE + "')")
+ @PreAuthorize("hasRole('" + OIDCC4UIEntitlement.OP_CREATE + "')")
public String createFromDiscovery(final OIDCC4UIProviderTO opTO) {
try {
OIDCClientCache.importMetadata(opTO);
@@ -74,7 +74,7 @@ public String createFromDiscovery(final OIDCC4UIProviderTO opTO) {
}
}
- @PreAuthorize("hasRole('" + OIDC4UIEntitlement.OP_CREATE + "')")
+ @PreAuthorize("hasRole('" + OIDCC4UIEntitlement.OP_CREATE + "')")
public String create(final OIDCC4UIProviderTO opTO) {
if (opTO.getConnObjectKeyItem() == null) {
Item connObjectKeyItem = new Item();
@@ -94,7 +94,7 @@ public List list() {
return opDAO.findAll().stream().map(binder::getOIDCProviderTO).collect(Collectors.toList());
}
- @PreAuthorize("hasRole('" + OIDC4UIEntitlement.OP_READ + "')")
+ @PreAuthorize("hasRole('" + OIDCC4UIEntitlement.OP_READ + "')")
@Transactional(readOnly = true)
public OIDCC4UIProviderTO read(final String key) {
OIDCC4UIProvider op = Optional.ofNullable(opDAO.find(key)).
@@ -103,7 +103,7 @@ public OIDCC4UIProviderTO read(final String key) {
return binder.getOIDCProviderTO(op);
}
- @PreAuthorize("hasRole('" + OIDC4UIEntitlement.OP_UPDATE + "')")
+ @PreAuthorize("hasRole('" + OIDCC4UIEntitlement.OP_UPDATE + "')")
public void update(final OIDCC4UIProviderTO opTO) {
OIDCC4UIProvider op = Optional.ofNullable(opDAO.find(opTO.getKey())).
orElseThrow(() -> new NotFoundException("OIDC Provider '" + opTO.getKey() + '\''));
@@ -121,7 +121,7 @@ public void update(final OIDCC4UIProviderTO opTO) {
oidcClientCacheLogout.removeAll(op.getName());
}
- @PreAuthorize("hasRole('" + OIDC4UIEntitlement.OP_DELETE + "')")
+ @PreAuthorize("hasRole('" + OIDCC4UIEntitlement.OP_DELETE + "')")
public void delete(final String key) {
OIDCC4UIProvider op = Optional.ofNullable(opDAO.find(key)).
orElseThrow(() -> new NotFoundException("OIDC Provider '" + key + '\''));
diff --git a/ext/oidcc4ui/logic/src/main/java/org/apache/syncope/core/logic/init/OIDCC4UILoader.java b/ext/oidcc4ui/logic/src/main/java/org/apache/syncope/core/logic/init/OIDCC4UILoader.java
index 93d240a484..d4e4f3e4d8 100644
--- a/ext/oidcc4ui/logic/src/main/java/org/apache/syncope/core/logic/init/OIDCC4UILoader.java
+++ b/ext/oidcc4ui/logic/src/main/java/org/apache/syncope/core/logic/init/OIDCC4UILoader.java
@@ -20,7 +20,7 @@
import org.apache.syncope.common.lib.types.EntitlementsHolder;
import org.apache.syncope.common.lib.types.ImplementationTypesHolder;
-import org.apache.syncope.common.lib.types.OIDC4UIEntitlement;
+import org.apache.syncope.common.lib.types.OIDCC4UIEntitlement;
import org.apache.syncope.common.lib.types.OIDCClientImplementationType;
import org.apache.syncope.core.persistence.api.SyncopeCoreLoader;
import org.springframework.core.Ordered;
@@ -34,7 +34,7 @@ public int getOrder() {
@Override
public void load() {
- EntitlementsHolder.getInstance().addAll(OIDC4UIEntitlement.values());
+ EntitlementsHolder.getInstance().addAll(OIDCC4UIEntitlement.values());
ImplementationTypesHolder.getInstance().putAll(OIDCClientImplementationType.values());
}
}
diff --git a/ext/oidcc4ui/logic/src/main/java/org/apache/syncope/core/logic/oidc/OIDC4UIContext.java b/ext/oidcc4ui/logic/src/main/java/org/apache/syncope/core/logic/oidc/OIDCC4UIContext.java
similarity index 98%
rename from ext/oidcc4ui/logic/src/main/java/org/apache/syncope/core/logic/oidc/OIDC4UIContext.java
rename to ext/oidcc4ui/logic/src/main/java/org/apache/syncope/core/logic/oidc/OIDCC4UIContext.java
index 0520b14c21..c23b4b982e 100644
--- a/ext/oidcc4ui/logic/src/main/java/org/apache/syncope/core/logic/oidc/OIDC4UIContext.java
+++ b/ext/oidcc4ui/logic/src/main/java/org/apache/syncope/core/logic/oidc/OIDCC4UIContext.java
@@ -26,7 +26,7 @@
import org.pac4j.core.context.Cookie;
import org.pac4j.core.context.WebContext;
-public class OIDC4UIContext implements WebContext {
+public class OIDCC4UIContext implements WebContext {
@Override
public String getRequestMethod() {
diff --git a/ext/saml2sp4ui/logic/src/main/java/org/apache/syncope/core/logic/SAML2SP4UILogic.java b/ext/saml2sp4ui/logic/src/main/java/org/apache/syncope/core/logic/SAML2SP4UILogic.java
index 0453a1ff41..19d515a711 100644
--- a/ext/saml2sp4ui/logic/src/main/java/org/apache/syncope/core/logic/SAML2SP4UILogic.java
+++ b/ext/saml2sp4ui/logic/src/main/java/org/apache/syncope/core/logic/SAML2SP4UILogic.java
@@ -319,10 +319,8 @@ public AuthnRequest build(final SAML2MessageContext context) {
@PreAuthorize("hasRole('" + IdRepoEntitlement.ANONYMOUS + "')")
public SAML2LoginResponse validateLoginResponse(final SAML2Response saml2Response) {
// 0. look for IdP
- SAML2SP4UIIdP idp = idpDAO.findByEntityID(saml2Response.getIdpEntityID());
- if (idp == null) {
- throw new NotFoundException("SAML 2.0 IdP '" + saml2Response.getIdpEntityID() + '\'');
- }
+ SAML2SP4UIIdP idp = Optional.ofNullable(idpDAO.findByEntityID(saml2Response.getIdpEntityID())).
+ orElseThrow(() -> new NotFoundException("SAML 2.0 IdP '" + saml2Response.getIdpEntityID() + '\''));
// 1. look for configured client
SAML2Client saml2Client = getSAML2Client(
@@ -376,7 +374,7 @@ public SAML2LoginResponse validateLoginResponse(final SAML2Response saml2Respons
for (SAML2AuthenticationCredentials.SAMLAttribute attr : authCreds.getAttributes()) {
if (!attr.getAttributeValues().isEmpty()) {
- String attrName = attr.getFriendlyName() == null ? attr.getName() : attr.getFriendlyName();
+ String attrName = Optional.ofNullable(attr.getFriendlyName()).orElse(attr.getName());
if (connObjectKeyItem != null && attrName.equals(connObjectKeyItem.getExtAttrName())) {
keyValue = attr.getAttributeValues().get(0);
}
@@ -385,9 +383,9 @@ public SAML2LoginResponse validateLoginResponse(final SAML2Response saml2Respons
}
}
- List matchingUsers = keyValue == null
- ? List.of()
- : userManager.findMatchingUser(keyValue, idp.getKey());
+ List matchingUsers = Optional.ofNullable(keyValue).
+ map(k -> userManager.findMatchingUser(k, idp.getKey())).
+ orElse(List.of());
LOG.debug("Found {} matching users for {}", matchingUsers.size(), keyValue);
String username;
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/BatchITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/BatchITCase.java
index 9138255349..8b1f2d5a6e 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/BatchITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/BatchITCase.java
@@ -32,16 +32,13 @@
import jakarta.ws.rs.core.Response;
import java.io.ByteArrayInputStream;
import java.io.IOException;
-import java.io.InputStream;
import java.net.URI;
-import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
-import org.apache.commons.io.IOUtils;
import org.apache.cxf.jaxrs.client.Client;
import org.apache.cxf.jaxrs.client.WebClient;
import org.apache.syncope.client.lib.batch.BatchRequest;
@@ -201,7 +198,7 @@ public void webClientSync() throws IOException {
assertTrue(response.getMediaType().toString().
startsWith(RESTHeaders.multipartMixedWith(boundary.substring(2))));
- String body = IOUtils.toString((InputStream) response.getEntity(), StandardCharsets.UTF_8);
+ String body = response.readEntity(String.class);
LOG.debug("Batch response body:\n{}", body);
check(BatchPayloadParser.parse(
@@ -245,7 +242,7 @@ public void webClientAsync() throws IOException {
assertTrue(response.getMediaType().toString().
startsWith(RESTHeaders.multipartMixedWith(boundary.substring(2))));
- String body = IOUtils.toString((InputStream) response.getEntity(), StandardCharsets.UTF_8);
+ String body = response.readEntity(String.class);
LOG.debug("Batch response body:\n{}", body);
check(BatchPayloadParser.parse(
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/BpmnProcessITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/BpmnProcessITCase.java
index 1d03b1097a..ac83c8976e 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/BpmnProcessITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/BpmnProcessITCase.java
@@ -26,9 +26,6 @@
import jakarta.ws.rs.core.Response;
import java.io.IOException;
-import java.io.InputStream;
-import java.nio.charset.StandardCharsets;
-import org.apache.commons.io.IOUtils;
import org.apache.syncope.client.lib.SyncopeClientFactoryBean;
import org.apache.syncope.common.lib.to.BpmnProcess;
import org.apache.syncope.fit.AbstractITCase;
@@ -62,8 +59,7 @@ public void exportUserWorkflowProcess() throws IOException {
Response response = BPMN_PROCESS_SERVICE.get(USER_WORKFLOW_KEY);
assertTrue(response.getMediaType().toString().
startsWith(CLIENT_FACTORY.getContentType().getMediaType().toString()));
- assertTrue(response.getEntity() instanceof InputStream);
- String definition = IOUtils.toString((InputStream) response.getEntity(), StandardCharsets.UTF_8);
+ String definition = response.readEntity(String.class);
assertNotNull(definition);
assertFalse(definition.isEmpty());
}
@@ -71,7 +67,7 @@ public void exportUserWorkflowProcess() throws IOException {
@Test
public void updateUserWorkflowProcess() throws IOException {
Response response = BPMN_PROCESS_SERVICE.get(USER_WORKFLOW_KEY);
- String definition = IOUtils.toString((InputStream) response.getEntity(), StandardCharsets.UTF_8);
+ String definition = response.readEntity(String.class);
BPMN_PROCESS_SERVICE.set(USER_WORKFLOW_KEY, definition);
}
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/MailTemplateITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/MailTemplateITCase.java
index d1cd7fc32d..14a42482d5 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/MailTemplateITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/MailTemplateITCase.java
@@ -27,7 +27,6 @@
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.Response;
import java.io.IOException;
-import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.util.List;
import org.apache.commons.io.IOUtils;
@@ -89,10 +88,7 @@ public void crud() throws IOException {
response = MAIL_TEMPLATE_SERVICE.getFormat(key, MailTemplateFormat.TEXT);
assertEquals(200, response.getStatus());
assertTrue(response.getMediaType().toString().startsWith(MediaType.TEXT_PLAIN));
- assertTrue(response.getEntity() instanceof InputStream);
- assertEquals(
- textTemplate,
- IOUtils.toString((InputStream) response.getEntity(), StandardCharsets.UTF_8));
+ assertEquals(textTemplate, response.readEntity(String.class));
// 3. set HTML
String htmlTemplate = "Hi there, I am ${username}.";
@@ -102,10 +98,7 @@ public void crud() throws IOException {
response = MAIL_TEMPLATE_SERVICE.getFormat(key, MailTemplateFormat.HTML);
assertEquals(200, response.getStatus());
assertTrue(response.getMediaType().toString().startsWith(MediaType.TEXT_HTML));
- assertTrue(response.getEntity() instanceof InputStream);
- assertEquals(
- htmlTemplate,
- IOUtils.toString((InputStream) response.getEntity(), StandardCharsets.UTF_8));
+ assertEquals(htmlTemplate, response.readEntity(String.class));
// 4. remove HTML
MAIL_TEMPLATE_SERVICE.removeFormat(key, MailTemplateFormat.HTML);
@@ -120,10 +113,7 @@ public void crud() throws IOException {
response = MAIL_TEMPLATE_SERVICE.getFormat(key, MailTemplateFormat.TEXT);
assertEquals(200, response.getStatus());
assertTrue(response.getMediaType().toString().startsWith(MediaType.TEXT_PLAIN));
- assertTrue(response.getEntity() instanceof InputStream);
- assertEquals(
- textTemplate,
- IOUtils.toString((InputStream) response.getEntity(), StandardCharsets.UTF_8));
+ assertEquals(textTemplate, response.readEntity(String.class));
// 5. remove mail template
MAIL_TEMPLATE_SERVICE.delete(key);
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/RESTITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/RESTITCase.java
index 35bccd020f..588ed0ee3f 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/RESTITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/RESTITCase.java
@@ -33,10 +33,7 @@
import jakarta.ws.rs.core.MultivaluedMap;
import jakarta.ws.rs.core.Response;
import java.io.IOException;
-import java.io.InputStream;
-import java.nio.charset.StandardCharsets;
import java.util.List;
-import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.cxf.jaxrs.client.WebClient;
@@ -108,9 +105,7 @@ public void noContent() throws IOException {
Response response = noContentService.create(groupCR);
assertEquals(Response.Status.CREATED.getStatusCode(), response.getStatus());
assertEquals(Preference.RETURN_NO_CONTENT.toString(), response.getHeaderString(RESTHeaders.PREFERENCE_APPLIED));
- assertEquals(
- StringUtils.EMPTY,
- IOUtils.toString((InputStream) response.getEntity(), StandardCharsets.UTF_8));
+ assertEquals(StringUtils.EMPTY, response.readEntity(String.class));
GroupTO group = getObject(response.getLocation(), GroupService.class, GroupTO.class);
assertNotNull(group);
@@ -122,16 +117,12 @@ public void noContent() throws IOException {
response = noContentService.update(groupUR);
assertEquals(Response.Status.NO_CONTENT.getStatusCode(), response.getStatus());
assertEquals(Preference.RETURN_NO_CONTENT.toString(), response.getHeaderString(RESTHeaders.PREFERENCE_APPLIED));
- assertEquals(
- StringUtils.EMPTY,
- IOUtils.toString((InputStream) response.getEntity(), StandardCharsets.UTF_8));
+ assertEquals(StringUtils.EMPTY, response.readEntity(String.class));
response = noContentService.delete(group.getKey());
assertEquals(Response.Status.NO_CONTENT.getStatusCode(), response.getStatus());
assertEquals(Preference.RETURN_NO_CONTENT.toString(), response.getHeaderString(RESTHeaders.PREFERENCE_APPLIED));
- assertEquals(
- StringUtils.EMPTY,
- IOUtils.toString((InputStream) response.getEntity(), StandardCharsets.UTF_8));
+ assertEquals(StringUtils.EMPTY, response.readEntity(String.class));
}
@Test
@@ -203,9 +194,7 @@ public void exportInternalStorageContent() throws IOException {
String contentDisposition = response.getHeaderString(HttpHeaders.CONTENT_DISPOSITION);
assertNotNull(contentDisposition);
- Object entity = response.getEntity();
- assertTrue(entity instanceof InputStream);
- String configExport = IOUtils.toString((InputStream) entity, StandardCharsets.UTF_8.name());
+ String configExport = response.readEntity(String.class);
assertFalse(configExport.isEmpty());
assertTrue(configExport.length() > 1000);
}
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ReportITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ReportITCase.java
index 74e6a218cd..81f56233b3 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ReportITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ReportITCase.java
@@ -28,14 +28,11 @@
import jakarta.ws.rs.core.HttpHeaders;
import jakarta.ws.rs.core.Response;
import java.io.IOException;
-import java.io.InputStream;
-import java.nio.charset.StandardCharsets;
import java.time.OffsetDateTime;
import java.util.List;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
-import org.apache.commons.io.IOUtils;
import org.apache.syncope.common.lib.SyncopeClientException;
import org.apache.syncope.common.lib.to.ExecTO;
import org.apache.syncope.common.lib.to.ReportTO;
@@ -158,9 +155,7 @@ public void executeAndExport() throws IOException {
assertNotNull(response.getHeaderString(HttpHeaders.CONTENT_DISPOSITION));
assertTrue(response.getHeaderString(HttpHeaders.CONTENT_DISPOSITION).endsWith(".pdf"));
- Object entity = response.getEntity();
- assertTrue(entity instanceof InputStream);
- assertFalse(IOUtils.toString((InputStream) entity, StandardCharsets.UTF_8.name()).isEmpty());
+ assertFalse(response.readEntity(String.class).isEmpty());
}
@Test
diff --git a/fit/wa-reference/src/test/java/org/apache/syncope/fit/AbstractITCase.java b/fit/wa-reference/src/test/java/org/apache/syncope/fit/AbstractITCase.java
index 2de353057f..939c90551b 100644
--- a/fit/wa-reference/src/test/java/org/apache/syncope/fit/AbstractITCase.java
+++ b/fit/wa-reference/src/test/java/org/apache/syncope/fit/AbstractITCase.java
@@ -22,12 +22,9 @@
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
-import com.nimbusds.jose.util.IOUtils;
import jakarta.ws.rs.core.HttpHeaders;
import jakarta.ws.rs.core.MediaType;
import java.io.IOException;
-import java.io.InputStream;
-import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
@@ -53,6 +50,7 @@
import org.apache.syncope.common.rest.api.service.UserService;
import org.apache.syncope.common.rest.api.service.wa.WAConfigService;
import org.apache.syncope.fit.sra.AbstractSRAITCase;
+import org.apereo.cas.oidc.OidcConstants;
import org.jsoup.Connection;
import org.jsoup.Jsoup;
import org.jsoup.nodes.FormElement;
@@ -117,26 +115,22 @@ public static void waitForWARefresh() {
await().atMost(60, TimeUnit.SECONDS).pollInterval(20, TimeUnit.SECONDS).until(() -> {
boolean refreshed = false;
try {
- String metadata = IOUtils.readInputStreamToString(
- (InputStream) WebClient.create(
- WA_ADDRESS + "/idp/metadata").get().getEntity(),
- StandardCharsets.UTF_8);
+ String metadata = WebClient.create(
+ WA_ADDRESS + "/idp/metadata").get().readEntity(String.class);
if (metadata.contains("localhost:8080")) {
WA_CONFIG_SERVICE.pushToWA(WAConfigService.PushSubject.conf, List.of());
throw new IllegalStateException();
}
- metadata = IOUtils.readInputStreamToString(
- (InputStream) WebClient.create(
- WA_ADDRESS + "/oidc/.well-known/openid-configuration").get().getEntity(),
- StandardCharsets.UTF_8);
+ metadata = WebClient.create(
+ WA_ADDRESS + "/oidc/" + OidcConstants.WELL_KNOWN_OPENID_CONFIGURATION_URL).
+ get().readEntity(String.class);
if (metadata.contains("localhost:8080")) {
WA_CONFIG_SERVICE.pushToWA(WAConfigService.PushSubject.conf, List.of());
throw new IllegalStateException();
}
- metadata = IOUtils.readInputStreamToString(
- (InputStream) WebClient.create(
- WA_ADDRESS + "/actuator/registeredServices", "anonymous", "anonymousKey", null).
- get().getEntity(), StandardCharsets.UTF_8);
+ metadata = WebClient.create(
+ WA_ADDRESS + "/actuator/registeredServices", "anonymous", "anonymousKey", null).
+ get().readEntity(String.class);
if (metadata.contains("localhost:8080/syncope-wa")) {
WA_CONFIG_SERVICE.pushToWA(WAConfigService.PushSubject.conf, List.of());
throw new IllegalStateException();
diff --git a/fit/wa-reference/src/test/java/org/apache/syncope/fit/sra/CASSRAITCase.java b/fit/wa-reference/src/test/java/org/apache/syncope/fit/sra/CASSRAITCase.java
index a9c0844514..825d7315bf 100644
--- a/fit/wa-reference/src/test/java/org/apache/syncope/fit/sra/CASSRAITCase.java
+++ b/fit/wa-reference/src/test/java/org/apache/syncope/fit/sra/CASSRAITCase.java
@@ -45,6 +45,7 @@
import org.apache.http.impl.client.HttpClients;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
+import org.apache.syncope.common.lib.SyncopeConstants;
import org.apache.syncope.common.lib.to.CASSPClientAppTO;
import org.apache.syncope.common.lib.types.ClientAppType;
import org.apache.syncope.common.rest.api.RESTHeaders;
@@ -71,6 +72,7 @@ public static void clientAppSetup() {
orElseGet(() -> {
CASSPClientAppTO app = new CASSPClientAppTO();
app.setName(appName);
+ app.setRealm(SyncopeConstants.ROOT_REALM);
app.setClientAppId(4L);
app.setServiceId("http://127.0.0.1:8080/.*");
diff --git a/fit/wa-reference/src/test/java/org/apache/syncope/fit/sra/OAUTH2SRAITCase.java b/fit/wa-reference/src/test/java/org/apache/syncope/fit/sra/OAUTH2SRAITCase.java
index f356adf8bc..cc5eae5b65 100644
--- a/fit/wa-reference/src/test/java/org/apache/syncope/fit/sra/OAUTH2SRAITCase.java
+++ b/fit/wa-reference/src/test/java/org/apache/syncope/fit/sra/OAUTH2SRAITCase.java
@@ -51,6 +51,7 @@ public static void clientAppSetup() {
} catch (Exception e) {
fail("Could not load /sra-oauth2.properties", e);
}
+ CLIENT_APP_ID = 2L;
CLIENT_ID = props.getProperty("sra.oauth2.client-id");
assertNotNull(CLIENT_ID);
CLIENT_SECRET = props.getProperty("sra.oauth2.client-secret");
@@ -58,7 +59,7 @@ public static void clientAppSetup() {
TOKEN_URI = props.getProperty("sra.oauth2.tokenUri");
assertNotNull(TOKEN_URI);
- oidcClientAppSetup(OAUTH2SRAITCase.class.getName(), "OAUTH2", 2L, CLIENT_ID, CLIENT_SECRET);
+ oidcClientAppSetup(OAUTH2SRAITCase.class.getName(), "OAUTH2", CLIENT_APP_ID, CLIENT_ID, CLIENT_SECRET);
}
@Override
diff --git a/fit/wa-reference/src/test/java/org/apache/syncope/fit/sra/OIDCSRAITCase.java b/fit/wa-reference/src/test/java/org/apache/syncope/fit/sra/OIDCSRAITCase.java
index fe056c1720..53d1f821aa 100644
--- a/fit/wa-reference/src/test/java/org/apache/syncope/fit/sra/OIDCSRAITCase.java
+++ b/fit/wa-reference/src/test/java/org/apache/syncope/fit/sra/OIDCSRAITCase.java
@@ -61,6 +61,7 @@
import org.apache.http.impl.client.HttpClients;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
+import org.apache.syncope.common.lib.SyncopeConstants;
import org.apache.syncope.common.lib.to.OIDCRPClientAppTO;
import org.apache.syncope.common.lib.types.ClientAppType;
import org.apache.syncope.common.lib.types.OIDCGrantType;
@@ -68,12 +69,15 @@
import org.apache.syncope.common.lib.types.OIDCSubjectType;
import org.apache.syncope.common.rest.api.RESTHeaders;
import org.apache.syncope.common.rest.api.service.wa.WAConfigService;
+import org.apereo.cas.oidc.OidcConstants;
import org.jsoup.Jsoup;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
public class OIDCSRAITCase extends AbstractSRAITCase {
+ protected static Long CLIENT_APP_ID;
+
protected static String CLIENT_ID;
protected static String CLIENT_SECRET;
@@ -101,6 +105,7 @@ protected static void oidcClientAppSetup(
orElseGet(() -> {
OIDCRPClientAppTO app = new OIDCRPClientAppTO();
app.setName(appName);
+ app.setRealm(SyncopeConstants.ROOT_REALM);
app.setClientAppId(clientAppId);
app.setClientId(clientId);
app.setClientSecret(clientSecret);
@@ -129,9 +134,9 @@ protected static void oidcClientAppSetup(
clientApp.getScopes().add(OIDCScope.profile);
clientApp.getScopes().add(OIDCScope.email);
clientApp.getSupportedGrantTypes().add(OIDCGrantType.password);
+ clientApp.getSupportedGrantTypes().add(OIDCGrantType.authorization_code);
CLIENT_APP_SERVICE.update(ClientAppType.OIDCRP, clientApp);
- WA_CONFIG_SERVICE.pushToWA(WAConfigService.PushSubject.clientApps, List.of());
}
@BeforeAll
@@ -144,17 +149,20 @@ public static void clientAppSetup() {
} catch (Exception e) {
fail("Could not load /sra-oidc.properties", e);
}
+ CLIENT_APP_ID = 1L;
CLIENT_ID = props.getProperty("sra.oidc.client-id");
assertNotNull(CLIENT_ID);
CLIENT_SECRET = props.getProperty("sra.oidc.client-secret");
assertNotNull(CLIENT_SECRET);
TOKEN_URI = WA_ADDRESS + "/oidc/accessToken";
- oidcClientAppSetup(OIDCSRAITCase.class.getName(), "OIDC", 1L, CLIENT_ID, CLIENT_SECRET);
+ oidcClientAppSetup(OIDCSRAITCase.class.getName(), "OIDC", CLIENT_APP_ID, CLIENT_ID, CLIENT_SECRET);
}
@Test
public void web() throws IOException {
+ WA_CONFIG_SERVICE.pushToWA(WAConfigService.PushSubject.clientApps, List.of());
+
CloseableHttpClient httpclient = HttpClients.createDefault();
HttpClientContext context = HttpClientContext.create();
context.setCookieStore(new BasicCookieStore());
@@ -253,21 +261,22 @@ protected boolean checkIdToken() {
@Test
public void rest() throws IOException, ParseException {
await().atMost(60, TimeUnit.SECONDS).pollInterval(20, TimeUnit.SECONDS).until(() -> {
- boolean refreshed = false;
try {
String metadata = WebClient.create(
- WA_ADDRESS + "/oidc/.well-known/openid-configuration").get().readEntity(String.class);
+ WA_ADDRESS + "/oidc/" + OidcConstants.WELL_KNOWN_OPENID_CONFIGURATION_URL).
+ get().readEntity(String.class);
if (!metadata.contains("groups")) {
WA_CONFIG_SERVICE.pushToWA(WAConfigService.PushSubject.conf, List.of());
throw new IllegalStateException();
}
- refreshed = true;
+ return true;
} catch (Exception e) {
// ignore
}
- return refreshed;
+ return false;
});
+ WA_CONFIG_SERVICE.pushToWA(WAConfigService.PushSubject.clientApps, List.of());
// 0. access public route
WebClient client = WebClient.create(SRA_ADDRESS + "/public/post").
diff --git a/fit/wa-reference/src/test/java/org/apache/syncope/fit/sra/SAML2SRAITCase.java b/fit/wa-reference/src/test/java/org/apache/syncope/fit/sra/SAML2SRAITCase.java
index dde18edef9..f2639ad1c2 100644
--- a/fit/wa-reference/src/test/java/org/apache/syncope/fit/sra/SAML2SRAITCase.java
+++ b/fit/wa-reference/src/test/java/org/apache/syncope/fit/sra/SAML2SRAITCase.java
@@ -46,6 +46,7 @@
import org.apache.http.impl.client.HttpClients;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
+import org.apache.syncope.common.lib.SyncopeConstants;
import org.apache.syncope.common.lib.to.SAML2SPClientAppTO;
import org.apache.syncope.common.lib.types.ClientAppType;
import org.apache.syncope.common.lib.types.SAML2SPNameId;
@@ -73,6 +74,7 @@ public static void clientAppSetup() {
orElseGet(() -> {
SAML2SPClientAppTO app = new SAML2SPClientAppTO();
app.setName(appName);
+ app.setRealm(SyncopeConstants.ROOT_REALM);
app.setClientAppId(3L);
app.setEntityId(SRA_ADDRESS);
app.setMetadataLocation(SRA_ADDRESS + "/saml2/metadata");
diff --git a/fit/wa-reference/src/test/java/org/apache/syncope/fit/ui/AbstractUIITCase.java b/fit/wa-reference/src/test/java/org/apache/syncope/fit/ui/AbstractUIITCase.java
index 9e5bc73a28..6378e72a94 100644
--- a/fit/wa-reference/src/test/java/org/apache/syncope/fit/ui/AbstractUIITCase.java
+++ b/fit/wa-reference/src/test/java/org/apache/syncope/fit/ui/AbstractUIITCase.java
@@ -84,10 +84,10 @@ protected static AttrReleasePolicyTO getAttrReleasePolicy() {
DefaultAttrReleasePolicyConf policyConf = new DefaultAttrReleasePolicyConf();
policyConf.getPrincipalAttrRepoConf().getAttrRepos().add(stubAttrRepo);
policyConf.getReleaseAttrs().put("attr1", "identifier");
- policyConf.getReleaseAttrs().put("firstname", "givenName");
- policyConf.getReleaseAttrs().put("surname", "sn");
- policyConf.getReleaseAttrs().put("fullname", "cn");
- policyConf.getReleaseAttrs().put("email", "mail");
+ policyConf.getReleaseAttrs().put("firstname", "given_name");
+ policyConf.getReleaseAttrs().put("surname", "family_name");
+ policyConf.getReleaseAttrs().put("fullname", "name");
+ policyConf.getReleaseAttrs().put("email", "email");
AttrReleasePolicyTO policy = new AttrReleasePolicyTO();
policy.setName(description);
diff --git a/fit/wa-reference/src/test/java/org/apache/syncope/fit/ui/OIDC4UIITCase.java b/fit/wa-reference/src/test/java/org/apache/syncope/fit/ui/OIDCC4UIITCase.java
similarity index 95%
rename from fit/wa-reference/src/test/java/org/apache/syncope/fit/ui/OIDC4UIITCase.java
rename to fit/wa-reference/src/test/java/org/apache/syncope/fit/ui/OIDCC4UIITCase.java
index 2445e00e72..f3d222218e 100644
--- a/fit/wa-reference/src/test/java/org/apache/syncope/fit/ui/OIDC4UIITCase.java
+++ b/fit/wa-reference/src/test/java/org/apache/syncope/fit/ui/OIDCC4UIITCase.java
@@ -46,6 +46,7 @@
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
import org.apache.syncope.client.ui.commons.panels.OIDCC4UIConstants;
+import org.apache.syncope.common.lib.SyncopeConstants;
import org.apache.syncope.common.lib.to.Item;
import org.apache.syncope.common.lib.to.OIDCC4UIProviderTO;
import org.apache.syncope.common.lib.to.OIDCRPClientAppTO;
@@ -58,7 +59,7 @@
import org.jsoup.Jsoup;
import org.junit.jupiter.api.BeforeAll;
-public class OIDC4UIITCase extends AbstractUIITCase {
+public class OIDCC4UIITCase extends AbstractUIITCase {
private static void clientAppSetup(final String appName, final String baseAddress, final long appId) {
OIDCRPClientAppTO clientApp = CLIENT_APP_SERVICE.list(ClientAppType.OIDCRP).stream().
@@ -68,6 +69,7 @@ private static void clientAppSetup(final String appName, final String baseAddres
orElseGet(() -> {
OIDCRPClientAppTO app = new OIDCRPClientAppTO();
app.setName(appName);
+ app.setRealm(SyncopeConstants.ROOT_REALM);
app.setClientAppId(appId);
app.setClientId(appName);
app.setClientSecret(appName);
@@ -104,8 +106,8 @@ private static void clientAppSetup(final String appName, final String baseAddres
private static String getAppName(final String address) {
return CONSOLE_ADDRESS.equals(address)
- ? OIDC4UIITCase.class.getName() + "_Console"
- : OIDC4UIITCase.class.getName() + "_Enduser";
+ ? OIDCC4UIITCase.class.getName() + "_Console"
+ : OIDCC4UIITCase.class.getName() + "_Enduser";
}
@BeforeAll
@@ -153,27 +155,27 @@ private static void oidcSetup(
item = new Item();
item.setIntAttrName("email");
- item.setExtAttrName("mail");
+ item.setExtAttrName("email");
cas.add(item);
item = new Item();
item.setIntAttrName("userId");
- item.setExtAttrName("mail");
+ item.setExtAttrName("email");
cas.add(item);
item = new Item();
item.setIntAttrName("firstname");
- item.setExtAttrName("givenName");
+ item.setExtAttrName("given_name");
cas.add(item);
item = new Item();
item.setIntAttrName("surname");
- item.setExtAttrName("sn");
+ item.setExtAttrName("family_name");
cas.add(item);
item = new Item();
item.setIntAttrName("fullname");
- item.setExtAttrName("cn");
+ item.setExtAttrName("name");
cas.add(item);
OIDCC4UI_PROVIDER_SERVICE.create(cas);
diff --git a/fit/wa-reference/src/test/java/org/apache/syncope/fit/ui/SAML2SP4UIITCase.java b/fit/wa-reference/src/test/java/org/apache/syncope/fit/ui/SAML2SP4UIITCase.java
index 6751bd66a4..f4fbfde991 100644
--- a/fit/wa-reference/src/test/java/org/apache/syncope/fit/ui/SAML2SP4UIITCase.java
+++ b/fit/wa-reference/src/test/java/org/apache/syncope/fit/ui/SAML2SP4UIITCase.java
@@ -48,6 +48,7 @@
import org.apache.http.util.EntityUtils;
import org.apache.syncope.client.ui.commons.SAML2SP4UIConstants;
import org.apache.syncope.common.lib.SyncopeClientException;
+import org.apache.syncope.common.lib.SyncopeConstants;
import org.apache.syncope.common.lib.to.Item;
import org.apache.syncope.common.lib.to.SAML2SP4UIIdPTO;
import org.apache.syncope.common.lib.to.SAML2SPClientAppTO;
@@ -68,6 +69,7 @@ private static void clientAppSetup(final String appName, final String entityId,
orElseGet(() -> {
SAML2SPClientAppTO app = new SAML2SPClientAppTO();
app.setName(appName);
+ app.setRealm(SyncopeConstants.ROOT_REALM);
app.setClientAppId(appId);
app.setEntityId(entityId);
app.setMetadataLocation(entityId + SAML2SP4UIConstants.URL_CONTEXT + "/metadata");
@@ -136,27 +138,27 @@ public static void idpSetup() {
item = new Item();
item.setIntAttrName("email");
- item.setExtAttrName("mail");
+ item.setExtAttrName("email");
cas.add(item);
item = new Item();
item.setIntAttrName("userId");
- item.setExtAttrName("mail");
+ item.setExtAttrName("email");
cas.add(item);
item = new Item();
item.setIntAttrName("firstname");
- item.setExtAttrName("givenName");
+ item.setExtAttrName("given_name");
cas.add(item);
item = new Item();
item.setIntAttrName("surname");
- item.setExtAttrName("sn");
+ item.setExtAttrName("family_name");
cas.add(item);
item = new Item();
item.setIntAttrName("fullname");
- item.setExtAttrName("cn");
+ item.setExtAttrName("name");
cas.add(item);
SAML2SP4UI_IDP_SERVICE.update(cas);
diff --git a/fit/wa-reference/src/test/resources/sra-oidc.properties b/fit/wa-reference/src/test/resources/sra-oidc.properties
index 9f7b8f3ea3..c4a60b99ba 100644
--- a/fit/wa-reference/src/test/resources/sra-oidc.properties
+++ b/fit/wa-reference/src/test/resources/sra-oidc.properties
@@ -22,5 +22,6 @@ sra.am-type=OIDC
sra.oidc.configuration=https://localhost:9443/syncope-wa/oidc
sra.oidc.client-id=oidcTestClientId
sra.oidc.client-secret=oidcTestClientSecret
+sra.oidc.scopes=openid,profile,email
sra.global.postLogout=http://localhost:8080/logout
diff --git a/pom.xml b/pom.xml
index 3b19b8cd03..a404ffa6a7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -414,7 +414,7 @@ under the License.
9.31
3.1.2
- 4.0.6
+ 4.0.7
4.0.0-SNAPSHOT
@@ -1212,7 +1212,7 @@ under the License.
org.springframework.cloud
spring-cloud-contract-wiremock
- 4.0.3
+ 4.0.4
test
diff --git a/sra/src/test/resources/debug/sra-debug.properties b/sra/src/test/resources/debug/sra-debug.properties
index 2efa2abf8d..38113343aa 100644
--- a/sra/src/test/resources/debug/sra-debug.properties
+++ b/sra/src/test/resources/debug/sra-debug.properties
@@ -22,6 +22,7 @@ keymaster.password=${anonymousKey}
#sra.oidc.configuration=https://localhost:9443/syncope-wa/oidc
#sra.oidc.client-id=oidcTestClientId
#sra.oidc.client-secret=oidcTestClientSecret
+#sra.oidc.scopes=openid,profile,email
#sra.am-type=OAUTH2
#sra.oauth2.tokenUri=https://localhost:9443/syncope-wa/oauth2.0/accessToken