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

[SYNCOPE-1585] Streamline OIDCC4UI ext #212

Merged
merged 2 commits into from Aug 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 0 additions & 5 deletions .travis.yml
Expand Up @@ -74,8 +74,6 @@ jobs:
- stage: test
name: "Persistence Unit Tests via JDK 11: PostgreSQL (JSONB)"
script: mvn -f core/persistence-jpa-json/pom.xml -P postgres -Dinvoker.streamLogs=true -Dmodernizer.skip=true -Dianal.skip=true -Drat.skip=true -Dcheckstyle.skip=true -Dsass.skip=true
after_failure:
- cat core/persistence-jpa-json/target/failsafe-reports/org.apache.syncope.core.persistence.jpa.inner.AnySearchTest*
- stage: test
name: "Persistence Unit Tests via JDK 11: MySQL (JSON)"
script: mvn -f core/persistence-jpa-json/pom.xml -P mysql -Dinvoker.streamLogs=true -Dmodernizer.skip=true -Dianal.skip=true -Drat.skip=true -Dcheckstyle.skip=true -Dsass.skip=true
Expand Down Expand Up @@ -119,7 +117,4 @@ jobs:
- stage: fit
name: "Integration Tests: SRA and WA"
script: mvn -f fit/wa-reference/pom.xml verify -Dinvoker.streamLogs=true -Dmodernizer.skip=true -Dianal.skip=true -Drat.skip=true -Dcheckstyle.skip=true -Djacoco.skip=true
after_failure:
- cat fit/wa-reference/target/log/*
- cat fit/core-reference/target/log/*
#####################################################
16 changes: 0 additions & 16 deletions archetype/pom.xml
Expand Up @@ -243,13 +243,6 @@ under the License.
<include>console.properties</include>
</includes>
</resource>
<resource>
<directory>../ext/oidcclient/agent/src/main/resources</directory>
<targetPath>${project.build.outputDirectory}/archetype-resources/console/src/main/resources/all</targetPath>
<includes>
<include>oidcclient-agent.properties</include>
</includes>
</resource>
<resource>
<directory>../ext/self-keymaster/client/src/main/resources</directory>
<targetPath>${project.build.outputDirectory}/archetype-resources/console/src/main/resources</targetPath>
Expand All @@ -271,7 +264,6 @@ under the License.
<includes>
<include>console.properties</include>
<include>keymaster.properties</include>
<include>oidcclient-agent.properties</include>
</includes>
</resource>
<resource>
Expand All @@ -296,13 +288,6 @@ under the License.
<include>keymaster.properties</include>
</includes>
</resource>
<resource>
<directory>../ext/oidcclient/agent/src/main/resources</directory>
<targetPath>${project.build.outputDirectory}/archetype-resources/enduser/src/main/resources/all</targetPath>
<includes>
<include>oidcclient-agent.properties</include>
</includes>
</resource>
<resource>
<directory>../fit/enduser-reference/src/main/resources</directory>
<targetPath>${project.build.outputDirectory}/archetype-resources/enduser/src/main/resources</targetPath>
Expand All @@ -319,7 +304,6 @@ under the License.
<include>customFormAttributes.json</include>
<include>customTemplate.json</include>
<include>keymaster.properties</include>
<include>oidcclient-agent.properties</include>
</includes>
</resource>
<resource>
Expand Down
Expand Up @@ -96,8 +96,8 @@ under the License.
</dependency>

<dependency>
<groupId>org.apache.syncope.ext.oidcclient</groupId>
<artifactId>syncope-ext-oidcclient-client-console</artifactId>
<groupId>org.apache.syncope.ext.oidcc4ui</groupId>
<artifactId>syncope-ext-oidcc4ui-client-console</artifactId>
<version>${syncope.version}</version>
</dependency>

Expand Down
8 changes: 4 additions & 4 deletions archetype/src/main/resources/archetype-resources/core/pom.xml
Expand Up @@ -150,13 +150,13 @@ under the License.
</dependency>

<dependency>
<groupId>org.apache.syncope.ext.oidcclient</groupId>
<artifactId>syncope-ext-oidcclient-rest-cxf</artifactId>
<groupId>org.apache.syncope.ext.oidcc4ui</groupId>
<artifactId>syncope-ext-oidcc4ui-rest-cxf</artifactId>
<version>${syncope.version}</version>
</dependency>
<dependency>
<groupId>org.apache.syncope.ext.oidcclient</groupId>
<artifactId>syncope-ext-oidcclient-persistence-jpa</artifactId>
<groupId>org.apache.syncope.ext.oidcc4ui</groupId>
<artifactId>syncope-ext-oidcc4ui-persistence-jpa</artifactId>
<version>${syncope.version}</version>
</dependency>

Expand Down
Expand Up @@ -104,8 +104,8 @@ under the License.
</dependency>

<dependency>
<groupId>org.apache.syncope.ext.oidcclient</groupId>
<artifactId>syncope-ext-oidcclient-client-enduser</artifactId>
<groupId>org.apache.syncope.ext.oidcc4ui</groupId>
<artifactId>syncope-ext-oidcc4ui-client-enduser</artifactId>
<version>${syncope.version}</version>
</dependency>

Expand Down
6 changes: 3 additions & 3 deletions client/idrepo/console/pom.xml
Expand Up @@ -260,7 +260,7 @@ under the License.
<configuration>
<jvmArguments>
-Dwicket.core.settings.general.configuration-type=development
-Xdebug -Xrunjdwp:transport=dt_socket,address=8001,server=y,suspend=n
-Xdebug -Xrunjdwp:transport=dt_socket,address=8003,server=y,suspend=n
</jvmArguments>
<profiles>
<profile>debug</profile>
Expand Down Expand Up @@ -327,8 +327,8 @@ under the License.
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.syncope.ext.oidcclient</groupId>
<artifactId>syncope-ext-oidcclient-client-console</artifactId>
<groupId>org.apache.syncope.ext.oidcc4ui</groupId>
<artifactId>syncope-ext-oidcc4ui-client-console</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
Expand Down
Expand Up @@ -17,3 +17,6 @@
keymaster.address=http://localhost:9080/syncope/rest/keymaster
keymaster.username=${anonymousUser}
keymaster.password=${anonymousKey}

server.port=9090
service.discovery.address=http://localhost:9090/syncope-console/
6 changes: 3 additions & 3 deletions client/idrepo/enduser/pom.xml
Expand Up @@ -240,7 +240,7 @@ under the License.
<configuration>
<jvmArguments>
-Dwicket.core.settings.general.configuration-type=development
-Xdebug -Xrunjdwp:transport=dt_socket,address=8001,server=y,suspend=n
-Xdebug -Xrunjdwp:transport=dt_socket,address=8004,server=y,suspend=n
</jvmArguments>
<profiles>
<profile>debug</profile>
Expand Down Expand Up @@ -285,8 +285,8 @@ under the License.
</dependency>

<dependency>
<groupId>org.apache.syncope.ext.oidcclient</groupId>
<artifactId>syncope-ext-oidcclient-client-enduser</artifactId>
<groupId>org.apache.syncope.ext.oidcc4ui</groupId>
<artifactId>syncope-ext-oidcc4ui-client-enduser</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
Expand Down
Expand Up @@ -17,3 +17,6 @@
keymaster.address=http://localhost:9080/syncope/rest/keymaster
keymaster.username=${anonymousUser}
keymaster.password=${anonymousKey}

server.port=9091
service.discovery.address=http://localhost:9091/syncope-enduser/
Expand Up @@ -42,6 +42,7 @@ public class JPAOIDCRP extends AbstractClientApp implements OIDCRP {

public static final String TABLE = "OIDCRP";

@Column(unique = true, nullable = false)
private String clientId;

private String clientSecret;
Expand Down
4 changes: 2 additions & 2 deletions docker/console/pom.xml
Expand Up @@ -84,8 +84,8 @@ under the License.
</dependency>

<dependency>
<groupId>org.apache.syncope.ext.oidcclient</groupId>
<artifactId>syncope-ext-oidcclient-client-console</artifactId>
<groupId>org.apache.syncope.ext.oidcc4ui</groupId>
<artifactId>syncope-ext-oidcc4ui-client-console</artifactId>
<version>${project.version}</version>
</dependency>

Expand Down
8 changes: 4 additions & 4 deletions docker/core/pom.xml
Expand Up @@ -126,13 +126,13 @@ under the License.
</dependency>

<dependency>
<groupId>org.apache.syncope.ext.oidcclient</groupId>
<artifactId>syncope-ext-oidcclient-rest-cxf</artifactId>
<groupId>org.apache.syncope.ext.oidcc4ui</groupId>
<artifactId>syncope-ext-oidcc4ui-rest-cxf</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.syncope.ext.oidcclient</groupId>
<artifactId>syncope-ext-oidcclient-persistence-jpa</artifactId>
<groupId>org.apache.syncope.ext.oidcc4ui</groupId>
<artifactId>syncope-ext-oidcc4ui-persistence-jpa</artifactId>
<version>${project.version}</version>
</dependency>

Expand Down
4 changes: 2 additions & 2 deletions docker/enduser/pom.xml
Expand Up @@ -73,8 +73,8 @@ under the License.
</dependency>

<dependency>
<groupId>org.apache.syncope.ext.oidcclient</groupId>
<artifactId>syncope-ext-oidcclient-client-enduser</artifactId>
<groupId>org.apache.syncope.ext.oidcc4ui</groupId>
<artifactId>syncope-ext-oidcc4ui-client-enduser</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
Expand Down
Expand Up @@ -23,14 +23,14 @@ under the License.

<parent>
<groupId>org.apache.syncope.ext</groupId>
<artifactId>syncope-ext-oidcclient</artifactId>
<artifactId>syncope-ext-oidcc4ui</artifactId>
<version>3.0.0-SNAPSHOT</version>
</parent>

<name>Apache Syncope Ext: OIDC Client Common UI Lib</name>
<description>Apache Syncope Ext: OIDC Client Common UI Lib</description>
<groupId>org.apache.syncope.ext.oidcclient</groupId>
<artifactId>syncope-ext-oidcclient-client-common-ui</artifactId>
<name>Apache Syncope Ext: OIDC C4UI Common UI</name>
<description>Apache Syncope Ext: OIDC C4UI Common UI</description>
<groupId>org.apache.syncope.ext.oidcc4ui</groupId>
<artifactId>syncope-ext-oidcc4ui-client-common-ui</artifactId>
<packaging>jar</packaging>

<properties>
Expand All @@ -39,8 +39,14 @@ under the License.

<dependencies>
<dependency>
<groupId>org.apache.syncope.ext.oidcclient</groupId>
<artifactId>syncope-ext-oidcclient-rest-api</artifactId>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.apache.syncope.ext.oidcc4ui</groupId>
<artifactId>syncope-ext-oidcc4ui-rest-api</artifactId>
<version>${project.version}</version>
</dependency>

Expand Down
Expand Up @@ -16,17 +16,15 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.syncope.client.common.ui.panels;
package org.apache.syncope.client.ui.commons.panels;

import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.List;
import org.apache.syncope.client.ui.commons.BaseSession;
import org.apache.syncope.client.ui.commons.Constants;
import org.apache.syncope.client.ui.commons.markup.html.form.AjaxDropDownChoicePanel;
import org.apache.syncope.client.ui.commons.panels.BaseSSOLoginFormPanel;
import org.apache.syncope.common.lib.to.OIDCProviderTO;
import org.apache.syncope.common.rest.api.service.OIDCProviderService;
import org.apache.syncope.common.lib.to.OIDCC4UIProviderTO;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
import org.apache.wicket.markup.html.form.IChoiceRenderer;
Expand All @@ -37,6 +35,7 @@
import org.apache.wicket.request.http.handler.RedirectRequestHandler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.syncope.common.rest.api.service.OIDCC4UIProviderService;

public abstract class AbstractOIDCSSOLoginFormPanel extends BaseSSOLoginFormPanel {

Expand All @@ -47,29 +46,29 @@ public abstract class AbstractOIDCSSOLoginFormPanel extends BaseSSOLoginFormPane
public AbstractOIDCSSOLoginFormPanel(final String id, final BaseSession session) {
super(id);

List<OIDCProviderTO> available = session.getAnonymousService(OIDCProviderService.class).list();
List<OIDCC4UIProviderTO> available = session.getAnonymousService(OIDCC4UIProviderService.class).list();

final Model<OIDCProviderTO> model = new Model<>();
AjaxDropDownChoicePanel<OIDCProviderTO> ops =
final Model<OIDCC4UIProviderTO> model = new Model<>();
AjaxDropDownChoicePanel<OIDCC4UIProviderTO> ops =
new AjaxDropDownChoicePanel<>("ops", "OpenID Connect", model, false);
ops.setChoices(available);
ops.setChoiceRenderer(new IChoiceRenderer<OIDCProviderTO>() {
ops.setChoiceRenderer(new IChoiceRenderer<OIDCC4UIProviderTO>() {

private static final long serialVersionUID = 1814750973898916102L;

@Override
public Object getDisplayValue(final OIDCProviderTO object) {
public Object getDisplayValue(final OIDCC4UIProviderTO object) {
return object.getName();
}

@Override
public String getIdValue(final OIDCProviderTO object, final int index) {
public String getIdValue(final OIDCC4UIProviderTO object, final int index) {
return object.getName();
}

@Override
public OIDCProviderTO getObject(final String id,
final IModel<? extends List<? extends OIDCProviderTO>> choices) {
public OIDCC4UIProviderTO getObject(final String id,
final IModel<? extends List<? extends OIDCC4UIProviderTO>> choices) {

return choices.getObject().stream().
filter(object -> object.getName().equals(id)).findFirst().orElse(null);
Expand All @@ -85,7 +84,7 @@ protected void onUpdate(final AjaxRequestTarget target) {
if (model.getObject() != null) {
try {
RequestCycle.get().scheduleRequestHandlerAfterCurrent(new RedirectRequestHandler(
UrlUtils.rewriteToContextRelative("oidcclient/login?op="
UrlUtils.rewriteToContextRelative(OIDCC4UIConstants.URL_CONTEXT + "/login?op="
+ URLEncoder.encode(model.getObject().getName(), StandardCharsets.UTF_8),
RequestCycle.get())));
} catch (Exception e) {
Expand Down
Expand Up @@ -16,21 +16,21 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.syncope.common.lib.to;
package org.apache.syncope.client.ui.commons.panels;

import java.io.Serializable;
public final class OIDCC4UIConstants {

public class OIDCLogoutRequestTO implements Serializable {
public static final String URL_CONTEXT = "oidcc4ui";

private static final long serialVersionUID = -4708360216757961537L;
public static final String PARAM_OP = "op";

private String endSessionEndpoint;
public static final String OIDCC4UI_JWT = "oidcc4ui.jwt";

public String getEndSessionEndpoint() {
return endSessionEndpoint;
}
public static final String OIDCC4UI_NEW_USER = "oidcc4ui.newUser";

public static final String OIDCC4UI_SLO_SUPPORTED = "oidcc4ui.sloSupported";

public void setEndSessionEndpoint(final String endSessionEndpoint) {
this.endSessionEndpoint = endSessionEndpoint;
private OIDCC4UIConstants() {
// private constructor for static utility class
}
}