Merge pull request #2812 from stianst/master
KEYCLOAK-2880 Refactor PermissionTest to not require Java8
This commit is contained in:
commit
0ec23fd40b
4 changed files with 1236 additions and 260 deletions
|
@ -27,6 +27,7 @@ import javax.ws.rs.core.MediaType;
|
||||||
import javax.ws.rs.core.UriInfo;
|
import javax.ws.rs.core.UriInfo;
|
||||||
import org.jboss.resteasy.annotations.cache.NoCache;
|
import org.jboss.resteasy.annotations.cache.NoCache;
|
||||||
import org.jboss.resteasy.plugins.providers.multipart.MultipartFormDataInput;
|
import org.jboss.resteasy.plugins.providers.multipart.MultipartFormDataInput;
|
||||||
|
import org.jboss.resteasy.plugins.providers.multipart.MultipartFormDataOutput;
|
||||||
import org.keycloak.representations.KeyStoreConfig;
|
import org.keycloak.representations.KeyStoreConfig;
|
||||||
import org.keycloak.representations.idm.CertificateRepresentation;
|
import org.keycloak.representations.idm.CertificateRepresentation;
|
||||||
|
|
||||||
|
@ -67,7 +68,7 @@ public interface ClientAttributeCertificateResource {
|
||||||
@Path("upload")
|
@Path("upload")
|
||||||
@Consumes(MediaType.MULTIPART_FORM_DATA)
|
@Consumes(MediaType.MULTIPART_FORM_DATA)
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
public CertificateRepresentation uploadJks(MultipartFormDataInput input);
|
public CertificateRepresentation uploadJks(MultipartFormDataOutput input);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Upload only certificate, not private key
|
* Upload only certificate, not private key
|
||||||
|
@ -79,7 +80,7 @@ public interface ClientAttributeCertificateResource {
|
||||||
@Path("upload-certificate")
|
@Path("upload-certificate")
|
||||||
@Consumes(MediaType.MULTIPART_FORM_DATA)
|
@Consumes(MediaType.MULTIPART_FORM_DATA)
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
public CertificateRepresentation uploadJksCertificate(MultipartFormDataInput input);
|
public CertificateRepresentation uploadJksCertificate(MultipartFormDataOutput input);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a keystore file for the client, containing private key and public certificate
|
* Get a keystore file for the client, containing private key and public certificate
|
||||||
|
|
|
@ -20,7 +20,6 @@ package org.keycloak.services.resources.admin;
|
||||||
import org.jboss.resteasy.annotations.cache.NoCache;
|
import org.jboss.resteasy.annotations.cache.NoCache;
|
||||||
import org.jboss.resteasy.plugins.providers.multipart.InputPart;
|
import org.jboss.resteasy.plugins.providers.multipart.InputPart;
|
||||||
import org.jboss.resteasy.plugins.providers.multipart.MultipartFormDataInput;
|
import org.jboss.resteasy.plugins.providers.multipart.MultipartFormDataInput;
|
||||||
import org.jboss.resteasy.spi.NotFoundException;
|
|
||||||
import org.jboss.resteasy.spi.ResteasyProviderFactory;
|
import org.jboss.resteasy.spi.ResteasyProviderFactory;
|
||||||
import org.keycloak.broker.provider.IdentityProvider;
|
import org.keycloak.broker.provider.IdentityProvider;
|
||||||
import org.keycloak.broker.provider.IdentityProviderFactory;
|
import org.keycloak.broker.provider.IdentityProviderFactory;
|
||||||
|
@ -37,6 +36,7 @@ import org.keycloak.representations.idm.IdentityProviderRepresentation;
|
||||||
import org.keycloak.services.ErrorResponse;
|
import org.keycloak.services.ErrorResponse;
|
||||||
import org.keycloak.broker.social.SocialIdentityProvider;
|
import org.keycloak.broker.social.SocialIdentityProvider;
|
||||||
|
|
||||||
|
import javax.ws.rs.BadRequestException;
|
||||||
import javax.ws.rs.Consumes;
|
import javax.ws.rs.Consumes;
|
||||||
import javax.ws.rs.GET;
|
import javax.ws.rs.GET;
|
||||||
import javax.ws.rs.POST;
|
import javax.ws.rs.POST;
|
||||||
|
@ -108,6 +108,9 @@ public class IdentityProvidersResource {
|
||||||
public Map<String, String> importFrom(@Context UriInfo uriInfo, MultipartFormDataInput input) throws IOException {
|
public Map<String, String> importFrom(@Context UriInfo uriInfo, MultipartFormDataInput input) throws IOException {
|
||||||
this.auth.requireManage();
|
this.auth.requireManage();
|
||||||
Map<String, List<InputPart>> formDataMap = input.getFormDataMap();
|
Map<String, List<InputPart>> formDataMap = input.getFormDataMap();
|
||||||
|
if (!(formDataMap.containsKey("providerId") && formDataMap.containsKey("file"))) {
|
||||||
|
throw new BadRequestException();
|
||||||
|
}
|
||||||
String providerId = formDataMap.get("providerId").get(0).getBodyAsString();
|
String providerId = formDataMap.get("providerId").get(0).getBodyAsString();
|
||||||
InputPart file = formDataMap.get("file").get(0);
|
InputPart file = formDataMap.get("file").get(0);
|
||||||
InputStream inputStream = file.getBody(InputStream.class, null);
|
InputStream inputStream = file.getBody(InputStream.class, null);
|
||||||
|
@ -130,7 +133,9 @@ public class IdentityProvidersResource {
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
public Map<String, String> importFrom(@Context UriInfo uriInfo, Map<String, Object> data) throws IOException {
|
public Map<String, String> importFrom(@Context UriInfo uriInfo, Map<String, Object> data) throws IOException {
|
||||||
this.auth.requireManage();
|
this.auth.requireManage();
|
||||||
|
if (!(data.containsKey("providerId") && data.containsKey("fromUrl"))) {
|
||||||
|
throw new BadRequestException();
|
||||||
|
}
|
||||||
String providerId = data.get("providerId").toString();
|
String providerId = data.get("providerId").toString();
|
||||||
String from = data.get("fromUrl").toString();
|
String from = data.get("fromUrl").toString();
|
||||||
InputStream inputStream = session.getProvider(HttpClientProvider.class).get(from);
|
InputStream inputStream = session.getProvider(HttpClientProvider.class).get(from);
|
||||||
|
|
|
@ -100,14 +100,6 @@
|
||||||
<artifactId>xml-maven-plugin</artifactId>
|
<artifactId>xml-maven-plugin</artifactId>
|
||||||
<version>1.0.1</version>
|
<version>1.0.1</version>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
|
||||||
<configuration>
|
|
||||||
<source>1.8</source>
|
|
||||||
<target>1.8</target>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
</plugins>
|
||||||
</pluginManagement>
|
</pluginManagement>
|
||||||
</build>
|
</build>
|
||||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue