Merge pull request #3503 from pedroigor/KEYCLOAK-3339
[KEYCLOAK-3339] - Enable authorization services to EAP6 adapter
This commit is contained in:
commit
a6d59faf98
14 changed files with 157 additions and 2 deletions
4
dependencies/server-all/pom.xml
vendored
4
dependencies/server-all/pom.xml
vendored
|
@ -255,6 +255,10 @@
|
||||||
</exclusion>
|
</exclusion>
|
||||||
</exclusions>
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.sonatype.sisu.inject</groupId>
|
||||||
|
<artifactId>guice-servlet</artifactId>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.sonatype.plexus</groupId>
|
<groupId>org.sonatype.plexus</groupId>
|
||||||
<artifactId>plexus-cipher</artifactId>
|
<artifactId>plexus-cipher</artifactId>
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
~ Copyright 2016 Red Hat, Inc. and/or its affiliates
|
~ Copyright 2016 Red Hat, Inc. and/or its affiliates
|
||||||
~ and other contributors as indicated by the @author tags.
|
~ and other contributors as indicated by the @author tags.
|
||||||
|
@ -39,6 +40,9 @@
|
||||||
<include>org/keycloak/keycloak-as7-subsystem/**</include>
|
<include>org/keycloak/keycloak-as7-subsystem/**</include>
|
||||||
<include>org/keycloak/keycloak-adapter-subsystem/**</include>
|
<include>org/keycloak/keycloak-adapter-subsystem/**</include>
|
||||||
<include>org/keycloak/keycloak-servlet-oauth-client/**</include>
|
<include>org/keycloak/keycloak-servlet-oauth-client/**</include>
|
||||||
|
|
||||||
|
<!-- Authorization -->
|
||||||
|
<include>org/keycloak/keycloak-authz-client/**</include>
|
||||||
</includes>
|
</includes>
|
||||||
<excludes>
|
<excludes>
|
||||||
<exclude>**/*.war</exclude>
|
<exclude>**/*.war</exclude>
|
||||||
|
|
|
@ -91,6 +91,10 @@
|
||||||
<maven-resource group="org.keycloak" artifact="keycloak-servlet-oauth-client"/>
|
<maven-resource group="org.keycloak" artifact="keycloak-servlet-oauth-client"/>
|
||||||
</module-def>
|
</module-def>
|
||||||
|
|
||||||
|
<!-- Authorization -->
|
||||||
|
<module-def name="org.keycloak.keycloak-authz-client">
|
||||||
|
<maven-resource group="org.keycloak" artifact="keycloak-authz-client"/>
|
||||||
|
</module-def>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="clean-target">
|
<target name="clean-target">
|
||||||
|
|
|
@ -102,6 +102,11 @@
|
||||||
<groupId>com.fasterxml.jackson.jaxrs</groupId>
|
<groupId>com.fasterxml.jackson.jaxrs</groupId>
|
||||||
<artifactId>jackson-jaxrs-json-provider</artifactId>
|
<artifactId>jackson-jaxrs-json-provider</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!-- Authorization -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.keycloak</groupId>
|
||||||
|
<artifactId>keycloak-authz-client</artifactId>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
<module name="org.keycloak.keycloak-common"/>
|
<module name="org.keycloak.keycloak-common"/>
|
||||||
<module name="org.keycloak.keycloak-core"/>
|
<module name="org.keycloak.keycloak-core"/>
|
||||||
<module name="org.keycloak.keycloak-adapter-spi"/>
|
<module name="org.keycloak.keycloak-adapter-spi"/>
|
||||||
|
<module name="org.keycloak.keycloak-authz-client"/>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</module>
|
</module>
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!--
|
||||||
|
~ JBoss, Home of Professional Open Source.
|
||||||
|
~ Copyright 2016 Red Hat, Inc., and individual contributors
|
||||||
|
~ as indicated by the @author tags.
|
||||||
|
~
|
||||||
|
~ Licensed 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.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<module xmlns="urn:jboss:module:1.1" name="org.keycloak.keycloak-authz-client">
|
||||||
|
<resources>
|
||||||
|
<!-- Insert resources here -->
|
||||||
|
</resources>
|
||||||
|
<dependencies>
|
||||||
|
<module name="org.bouncycastle" />
|
||||||
|
<module name="javax.api"/>
|
||||||
|
<module name="javax.activation.api"/>
|
||||||
|
<module name="sun.jdk" optional="true" />
|
||||||
|
<module name="javax.ws.rs.api"/>
|
||||||
|
<module name="org.keycloak.keycloak-core"/>
|
||||||
|
<module name="org.keycloak.keycloak-common"/>
|
||||||
|
<module name="org.apache.httpcomponents"/>
|
||||||
|
<module name="com.fasterxml.jackson.core.jackson-core"/>
|
||||||
|
<module name="com.fasterxml.jackson.core.jackson-annotations"/>
|
||||||
|
<module name="com.fasterxml.jackson.core.jackson-databind"/>
|
||||||
|
<module name="com.fasterxml.jackson.jaxrs.jackson-jaxrs-json-provider"/>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
</module>
|
|
@ -39,6 +39,9 @@
|
||||||
<include>org/keycloak/keycloak-as7-subsystem/**</include>
|
<include>org/keycloak/keycloak-as7-subsystem/**</include>
|
||||||
<include>org/keycloak/keycloak-adapter-subsystem/**</include>
|
<include>org/keycloak/keycloak-adapter-subsystem/**</include>
|
||||||
<include>org/keycloak/keycloak-servlet-oauth-client/**</include>
|
<include>org/keycloak/keycloak-servlet-oauth-client/**</include>
|
||||||
|
|
||||||
|
<!-- Authorization -->
|
||||||
|
<include>org/keycloak/keycloak-authz-client/**</include>
|
||||||
</includes>
|
</includes>
|
||||||
<excludes>
|
<excludes>
|
||||||
<exclude>**/*.war</exclude>
|
<exclude>**/*.war</exclude>
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
<resources>
|
<resources>
|
||||||
<artifact name="${org.eclipse.sisu:org.eclipse.sisu.inject}"/>
|
<artifact name="${org.eclipse.sisu:org.eclipse.sisu.inject}"/>
|
||||||
<artifact name="${org.eclipse.sisu:org.eclipse.sisu.plexus}"/>
|
<artifact name="${org.eclipse.sisu:org.eclipse.sisu.plexus}"/>
|
||||||
|
<artifact name="${org.sonatype.sisu.inject:guice-servlet}"/>
|
||||||
</resources>
|
</resources>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<module name="javax.api"/>
|
<module name="javax.api"/>
|
||||||
|
|
2
pom.xml
2
pom.xml
|
@ -80,7 +80,7 @@
|
||||||
|
|
||||||
<!-- Authorization Drools Policy Provider -->
|
<!-- Authorization Drools Policy Provider -->
|
||||||
<version.org.drools>6.4.0.Final</version.org.drools>
|
<version.org.drools>6.4.0.Final</version.org.drools>
|
||||||
<version.jboss-integration-platform>6.0.6.Final</version.jboss-integration-platform>
|
<version.jboss-integration-platform>6.0.10.Final</version.jboss-integration-platform>
|
||||||
|
|
||||||
<!-- Others -->
|
<!-- Others -->
|
||||||
<apacheds.version>2.0.0-M21</apacheds.version>
|
<apacheds.version>2.0.0-M21</apacheds.version>
|
||||||
|
|
|
@ -34,6 +34,8 @@ import java.util.Set;
|
||||||
@Transaction
|
@Transaction
|
||||||
public class AlbumService {
|
public class AlbumService {
|
||||||
|
|
||||||
|
private static volatile long nextId = 0;
|
||||||
|
|
||||||
public static final String SCOPE_ALBUM_VIEW = "urn:photoz.com:scopes:album:view";
|
public static final String SCOPE_ALBUM_VIEW = "urn:photoz.com:scopes:album:view";
|
||||||
public static final String SCOPE_ALBUM_CREATE = "urn:photoz.com:scopes:album:create";
|
public static final String SCOPE_ALBUM_CREATE = "urn:photoz.com:scopes:album:create";
|
||||||
public static final String SCOPE_ALBUM_DELETE = "urn:photoz.com:scopes:album:delete";
|
public static final String SCOPE_ALBUM_DELETE = "urn:photoz.com:scopes:album:delete";
|
||||||
|
@ -53,6 +55,8 @@ public class AlbumService {
|
||||||
@POST
|
@POST
|
||||||
@Consumes("application/json")
|
@Consumes("application/json")
|
||||||
public Response create(Album newAlbum) {
|
public Response create(Album newAlbum) {
|
||||||
|
newAlbum.setId(++nextId);
|
||||||
|
|
||||||
Principal userPrincipal = request.getUserPrincipal();
|
Principal userPrincipal = request.getUserPrincipal();
|
||||||
|
|
||||||
newAlbum.setUserId(userPrincipal.getName());
|
newAlbum.setUserId(userPrincipal.getName());
|
||||||
|
|
|
@ -23,6 +23,7 @@ import javax.persistence.FetchType;
|
||||||
import javax.persistence.GeneratedValue;
|
import javax.persistence.GeneratedValue;
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
import javax.persistence.OneToMany;
|
import javax.persistence.OneToMany;
|
||||||
|
import javax.persistence.GenerationType;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -33,7 +34,6 @@ import java.util.List;
|
||||||
public class Album {
|
public class Album {
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue
|
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@Column(nullable = false)
|
@Column(nullable = false)
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2016 Red Hat, Inc. and/or its affiliates
|
||||||
|
* and other contributors as indicated by the @author tags.
|
||||||
|
*
|
||||||
|
* Licensed 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.keycloak.testsuite.adapter.example.authorization;
|
||||||
|
|
||||||
|
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author tkyjovsk
|
||||||
|
*/
|
||||||
|
@AppServerContainer("app-server-eap6")
|
||||||
|
public class EAP6DefaultAuthzConfigAdapterTest extends AbstractDefaultAuthzConfigAdapterTest {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2016 Red Hat, Inc. and/or its affiliates
|
||||||
|
* and other contributors as indicated by the @author tags.
|
||||||
|
*
|
||||||
|
* Licensed 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.keycloak.testsuite.adapter.example.authorization;
|
||||||
|
|
||||||
|
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author tkyjovsk
|
||||||
|
*/
|
||||||
|
@AppServerContainer("app-server-eap6")
|
||||||
|
//@AdapterLibsLocationProperty("adapter.libs.wildfly")
|
||||||
|
public class EAP6PhotozExampleAdapterTest extends AbstractPhotozExampleAdapterTest {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2016 Red Hat, Inc. and/or its affiliates
|
||||||
|
* and other contributors as indicated by the @author tags.
|
||||||
|
*
|
||||||
|
* Licensed 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.keycloak.testsuite.adapter.example.authorization;
|
||||||
|
|
||||||
|
import org.jboss.arquillian.container.test.api.RunAsClient;
|
||||||
|
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author tkyjovsk
|
||||||
|
*/
|
||||||
|
@RunAsClient
|
||||||
|
@AppServerContainer("app-server-eap6")
|
||||||
|
public class EAP6ServletAuthzAdapterTest extends AbstractServletAuthzAdapterTest {
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in a new issue