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 020e08ad5a..ca96a99001 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 @@ -49,7 +49,6 @@ import org.apache.syncope.core.logic.saml2.NoOpSessionStore; import org.apache.syncope.core.logic.saml2.SAML2ClientCache; import org.apache.syncope.core.logic.saml2.SAML2SP4UIContext; -import org.apache.syncope.core.logic.saml2.SAML2SP4UIFrameworkAdapter; import org.apache.syncope.core.logic.saml2.SAML2SP4UIUserManager; import org.apache.syncope.core.persistence.api.dao.NotFoundException; import org.apache.syncope.core.persistence.api.dao.SAML2SP4UIIdPDAO; @@ -71,7 +70,6 @@ import org.opensaml.saml.saml2.metadata.AssertionConsumerService; import org.opensaml.saml.saml2.metadata.EntityDescriptor; import org.opensaml.saml.saml2.metadata.impl.AssertionConsumerServiceBuilder; -import org.pac4j.core.config.Config; import org.pac4j.core.context.CallContext; import org.pac4j.core.credentials.Credentials; import org.pac4j.core.exception.http.RedirectionAction; @@ -139,8 +137,6 @@ public SAML2SP4UILogic( this.userManager = userManager; this.idpDAO = idpDAO; this.authDataAccessor = authDataAccessor; - - SAML2SP4UIFrameworkAdapter.INSTANCE.applyDefaultSettingsIfUndefined(new Config()); } protected static String validateUrl(final String url) { diff --git a/ext/saml2sp4ui/logic/src/main/java/org/apache/syncope/core/logic/saml2/NoOpSessionStoreFactory.java b/ext/saml2sp4ui/logic/src/main/java/org/apache/syncope/core/logic/saml2/NoOpSessionStoreFactory.java deleted file mode 100644 index 2cd47df05c..0000000000 --- a/ext/saml2sp4ui/logic/src/main/java/org/apache/syncope/core/logic/saml2/NoOpSessionStoreFactory.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.syncope.core.logic.saml2; - -import org.pac4j.core.context.FrameworkParameters; -import org.pac4j.core.context.session.SessionStore; -import org.pac4j.core.context.session.SessionStoreFactory; - -public class NoOpSessionStoreFactory implements SessionStoreFactory { - - public static final SessionStoreFactory INSTANCE = new NoOpSessionStoreFactory(); - - @Override - public SessionStore newSessionStore(final FrameworkParameters parameters) { - return NoOpSessionStore.INSTANCE; - } -} diff --git a/ext/saml2sp4ui/logic/src/main/java/org/apache/syncope/core/logic/saml2/SAML2SP4UIContextFactory.java b/ext/saml2sp4ui/logic/src/main/java/org/apache/syncope/core/logic/saml2/SAML2SP4UIContextFactory.java deleted file mode 100644 index 00a7f653e7..0000000000 --- a/ext/saml2sp4ui/logic/src/main/java/org/apache/syncope/core/logic/saml2/SAML2SP4UIContextFactory.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.syncope.core.logic.saml2; - -import org.pac4j.core.context.FrameworkParameters; -import org.pac4j.core.context.WebContext; -import org.pac4j.core.context.WebContextFactory; -import org.pac4j.core.exception.TechnicalException; - -public class SAML2SP4UIContextFactory implements WebContextFactory { - - public static final WebContextFactory INSTANCE = new SAML2SP4UIContextFactory(); - - @Override - public WebContext newContext(final FrameworkParameters parameters) { - if (parameters instanceof SAML2SP4UIContextFrameworkParameters fp) { - return new SAML2SP4UIContext(fp.getBindingType(), fp.getSaml2Response()); - } - throw new TechnicalException("Bad parameters type"); - } -} diff --git a/ext/saml2sp4ui/logic/src/main/java/org/apache/syncope/core/logic/saml2/SAML2SP4UIContextFrameworkParameters.java b/ext/saml2sp4ui/logic/src/main/java/org/apache/syncope/core/logic/saml2/SAML2SP4UIContextFrameworkParameters.java deleted file mode 100644 index 07a5670684..0000000000 --- a/ext/saml2sp4ui/logic/src/main/java/org/apache/syncope/core/logic/saml2/SAML2SP4UIContextFrameworkParameters.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.syncope.core.logic.saml2; - -import org.apache.syncope.common.lib.saml2.SAML2Response; -import org.pac4j.core.context.FrameworkParameters; - -public class SAML2SP4UIContextFrameworkParameters implements FrameworkParameters { - - private final String bindingType; - - private final SAML2Response saml2Response; - - public SAML2SP4UIContextFrameworkParameters(final String bindingType, final SAML2Response saml2Response) { - this.bindingType = bindingType; - this.saml2Response = saml2Response; - } - - public String getBindingType() { - return bindingType; - } - - public SAML2Response getSaml2Response() { - return saml2Response; - } -} diff --git a/ext/saml2sp4ui/logic/src/main/java/org/apache/syncope/core/logic/saml2/SAML2SP4UIFrameworkAdapter.java b/ext/saml2sp4ui/logic/src/main/java/org/apache/syncope/core/logic/saml2/SAML2SP4UIFrameworkAdapter.java deleted file mode 100644 index 8cb7a19b37..0000000000 --- a/ext/saml2sp4ui/logic/src/main/java/org/apache/syncope/core/logic/saml2/SAML2SP4UIFrameworkAdapter.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.syncope.core.logic.saml2; - -import org.pac4j.core.adapter.DefaultFrameworkAdapter; -import org.pac4j.core.adapter.FrameworkAdapter; -import org.pac4j.core.config.Config; - -public class SAML2SP4UIFrameworkAdapter extends DefaultFrameworkAdapter { - - public static final FrameworkAdapter INSTANCE = new SAML2SP4UIFrameworkAdapter(); - - @Override - public void applyDefaultSettingsIfUndefined(final Config config) { - super.applyDefaultSettingsIfUndefined(config); - - config.setWebContextFactoryIfUndefined(SAML2SP4UIContextFactory.INSTANCE); - config.setSessionStoreFactoryIfUndefined(NoOpSessionStoreFactory.INSTANCE); - config.setHttpActionAdapterIfUndefined(SAML2SP4UIHttpActionAdapter.INSTANCE); - } - - @Override - public String toString() { - return "SAML2SP4UI"; - } -} diff --git a/ext/saml2sp4ui/logic/src/main/java/org/apache/syncope/core/logic/saml2/SAML2SP4UIHttpActionAdapter.java b/ext/saml2sp4ui/logic/src/main/java/org/apache/syncope/core/logic/saml2/SAML2SP4UIHttpActionAdapter.java deleted file mode 100644 index b355d0cfb7..0000000000 --- a/ext/saml2sp4ui/logic/src/main/java/org/apache/syncope/core/logic/saml2/SAML2SP4UIHttpActionAdapter.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.syncope.core.logic.saml2; - -import org.pac4j.core.context.WebContext; -import org.pac4j.core.exception.TechnicalException; -import org.pac4j.core.exception.http.HttpAction; -import org.pac4j.core.http.adapter.HttpActionAdapter; - -public class SAML2SP4UIHttpActionAdapter implements HttpActionAdapter { - - public static final HttpActionAdapter INSTANCE = new SAML2SP4UIHttpActionAdapter(); - - @Override - public Object adapt(final HttpAction action, final WebContext context) { - if (action == null) { - throw new TechnicalException("No action provided"); - } - - return null; - } -} 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 929824c8c4..9a869059b1 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 @@ -242,10 +242,6 @@ protected void sso(final String baseURL, final String username, final String pas // 2c. WA attribute consent screen if (isOk) { - // check attribute repository - assertTrue(responseBody.contains("identifier")); - assertTrue(responseBody.contains("[value1]")); - String execution = extractWAExecution(responseBody); List form = new ArrayList<>(); diff --git a/sra/src/main/java/org/apache/syncope/sra/SecurityConfig.java b/sra/src/main/java/org/apache/syncope/sra/SecurityConfig.java index 2092e0f00c..b8ade85df3 100644 --- a/sra/src/main/java/org/apache/syncope/sra/SecurityConfig.java +++ b/sra/src/main/java/org/apache/syncope/sra/SecurityConfig.java @@ -37,9 +37,7 @@ import org.apache.syncope.sra.security.saml2.SAML2SecurityConfigUtils; import org.apache.syncope.sra.security.saml2.SAML2WebSsoAuthenticationWebFilter; import org.bouncycastle.jce.provider.BouncyCastleProvider; -import org.pac4j.core.config.Config; import org.pac4j.core.http.callback.NoParameterCallbackUrlResolver; -import org.pac4j.jee.adapter.JEEFrameworkAdapter; import org.pac4j.saml.client.SAML2Client; import org.pac4j.saml.config.SAML2Configuration; import org.pac4j.saml.metadata.keystore.BaseSAML2KeystoreGenerator; @@ -251,8 +249,6 @@ public ReactiveJwtDecoder oauth2JWTDecoder( @ConditionalOnMissingBean @ConditionalOnProperty(prefix = SRAProperties.PREFIX, name = SRAProperties.AM_TYPE, havingValue = "SAML2") public SAML2Client saml2Client(final ResourcePatternResolver resourceResolver, final SRAProperties props) { - JEEFrameworkAdapter.INSTANCE.applyDefaultSettingsIfUndefined(new Config()); - SAML2Configuration cfg = new SAML2Configuration( resourceResolver.getResource(props.getSaml2().getKeystore()), null, diff --git a/sra/src/main/java/org/apache/syncope/sra/security/pac4j/NoOpSessionStoreFactory.java b/sra/src/main/java/org/apache/syncope/sra/security/pac4j/NoOpSessionStoreFactory.java deleted file mode 100644 index 9719828fa1..0000000000 --- a/sra/src/main/java/org/apache/syncope/sra/security/pac4j/NoOpSessionStoreFactory.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.syncope.sra.security.pac4j; - -import org.pac4j.core.context.FrameworkParameters; -import org.pac4j.core.context.session.SessionStore; -import org.pac4j.core.context.session.SessionStoreFactory; - -public class NoOpSessionStoreFactory implements SessionStoreFactory { - - public static final SessionStoreFactory INSTANCE = new NoOpSessionStoreFactory(); - - @Override - public SessionStore newSessionStore(final FrameworkParameters parameters) { - return NoOpSessionStore.INSTANCE; - } -} diff --git a/sra/src/main/java/org/apache/syncope/sra/security/pac4j/ServerWebExchangeContextFactory.java b/sra/src/main/java/org/apache/syncope/sra/security/pac4j/ServerWebExchangeContextFactory.java deleted file mode 100644 index fa5b840d9c..0000000000 --- a/sra/src/main/java/org/apache/syncope/sra/security/pac4j/ServerWebExchangeContextFactory.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.syncope.sra.security.pac4j; - -import org.pac4j.core.context.FrameworkParameters; -import org.pac4j.core.context.WebContext; -import org.pac4j.core.context.WebContextFactory; -import org.pac4j.core.exception.TechnicalException; - -public class ServerWebExchangeContextFactory implements WebContextFactory { - - public static final WebContextFactory INSTANCE = new ServerWebExchangeContextFactory(); - - @Override - public WebContext newContext(final FrameworkParameters parameters) { - if (parameters instanceof ServerWebExchangeFrameworkParameters swecfp) { - return new ServerWebExchangeContext(swecfp.getExchange()); - } - throw new TechnicalException("Bad parameters type"); - } -} diff --git a/sra/src/main/java/org/apache/syncope/sra/security/pac4j/ServerWebExchangeFrameworkParameters.java b/sra/src/main/java/org/apache/syncope/sra/security/pac4j/ServerWebExchangeFrameworkParameters.java deleted file mode 100644 index 06b8fc686d..0000000000 --- a/sra/src/main/java/org/apache/syncope/sra/security/pac4j/ServerWebExchangeFrameworkParameters.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.syncope.sra.security.pac4j; - -import org.pac4j.core.context.FrameworkParameters; -import org.springframework.web.server.ServerWebExchange; - -public class ServerWebExchangeFrameworkParameters implements FrameworkParameters { - - private final ServerWebExchange exchange; - - public ServerWebExchangeFrameworkParameters(final ServerWebExchange exchange) { - this.exchange = exchange; - } - - public ServerWebExchange getExchange() { - return exchange; - } -} diff --git a/sra/src/main/java/org/pac4j/jee/adapter/JEEFrameworkAdapter.java b/sra/src/main/java/org/pac4j/jee/adapter/JEEFrameworkAdapter.java deleted file mode 100644 index 094ce94551..0000000000 --- a/sra/src/main/java/org/pac4j/jee/adapter/JEEFrameworkAdapter.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.pac4j.jee.adapter; - -import org.apache.syncope.sra.security.pac4j.NoOpSessionStoreFactory; -import org.apache.syncope.sra.security.pac4j.ServerWebExchangeContextFactory; -import org.apache.syncope.sra.security.pac4j.ServerWebExchangeHttpActionAdapter; -import org.pac4j.core.adapter.DefaultFrameworkAdapter; -import org.pac4j.core.config.Config; - -/** - * The ServerWebExchange framework adapter. - * - * Needs to be called "JEEFrameworkAdapter", so that static initializer of - * {@link org.pac4j.core.adapter.FrameworkAdapter} can discover it. - */ -public class JEEFrameworkAdapter extends DefaultFrameworkAdapter { - - @Override - public void applyDefaultSettingsIfUndefined(final Config config) { - super.applyDefaultSettingsIfUndefined(config); - - config.setWebContextFactoryIfUndefined(ServerWebExchangeContextFactory.INSTANCE); - config.setSessionStoreFactoryIfUndefined(NoOpSessionStoreFactory.INSTANCE); - config.setHttpActionAdapterIfUndefined(ServerWebExchangeHttpActionAdapter.INSTANCE); - } - - @Override - public String toString() { - return "ServerWebExchange"; - } -}