removed the use of @Context (#3867)

as this is no longer supported in keycloak
This commit is contained in:
Erik Jan de Wit 2022-11-24 08:36:36 -05:00 committed by GitHub
parent 03520dc30a
commit 93f00ecd13
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 21 additions and 28 deletions

View file

@ -28,6 +28,6 @@ public final class AuthenticationManagementProvider implements AdminRealmResourc
}
public Object getResource(KeycloakSession session, RealmModel realm, AdminPermissionEvaluator auth, AdminEventBuilder adminEvent) {
return new AuthenticationManagementResource(realm, auth);
return new AuthenticationManagementResource(session, realm, auth);
}
}

View file

@ -11,7 +11,6 @@ import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import org.eclipse.microprofile.openapi.annotations.Operation;
import org.eclipse.microprofile.openapi.annotations.enums.SchemaType;
import org.eclipse.microprofile.openapi.annotations.media.Content;
@ -32,16 +31,16 @@ import org.keycloak.services.resources.admin.permissions.AdminPermissionEvaluato
@Consumes({"application/json"})
@Produces({"application/json"})
public class AuthenticationManagementResource extends RoleMappingResource {
@Context
private KeycloakSession session;
private final KeycloakSession session;
private RealmModel realm;
private AdminPermissionEvaluator auth;
public AuthenticationManagementResource(RealmModel realm, AdminPermissionEvaluator auth) {
public AuthenticationManagementResource(KeycloakSession session, RealmModel realm, AdminPermissionEvaluator auth) {
super(realm, auth);
this.realm = realm;
this.auth = auth;
this.session = session;
}
@GET

View file

@ -30,6 +30,6 @@ public final class AvailableRoleMappingProvider implements AdminRealmResourcePro
}
public Object getResource(KeycloakSession session, RealmModel realm, AdminPermissionEvaluator auth, AdminEventBuilder adminEvent) {
return new AvailableRoleMappingResource(realm, auth);
return new AvailableRoleMappingResource(session, realm, auth);
}
}

View file

@ -12,7 +12,6 @@ import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import org.eclipse.microprofile.openapi.annotations.Operation;
import org.eclipse.microprofile.openapi.annotations.enums.SchemaType;
import org.eclipse.microprofile.openapi.annotations.media.Content;
@ -30,15 +29,15 @@ import org.keycloak.models.UserProvider;
import org.keycloak.services.resources.admin.permissions.AdminPermissionEvaluator;
public class AvailableRoleMappingResource extends RoleMappingResource {
@Context
private KeycloakSession session;
private final KeycloakSession session;
private final RealmModel realm;
private final AdminPermissionEvaluator auth;
public AvailableRoleMappingResource(RealmModel realm, AdminPermissionEvaluator auth) {
public AvailableRoleMappingResource(KeycloakSession session, RealmModel realm, AdminPermissionEvaluator auth) {
super(realm, auth);
this.realm = realm;
this.auth = auth;
this.session = session;
}
@GET

View file

@ -30,6 +30,6 @@ public final class BruteForceUsersProvider implements AdminRealmResourceProvider
}
public Object getResource(KeycloakSession session, RealmModel realm, AdminPermissionEvaluator auth, AdminEventBuilder adminEvent) {
return new BruteForceUsersResource(realm, auth);
return new BruteForceUsersResource(session, realm, auth);
}
}

View file

@ -2,7 +2,6 @@ package org.keycloak.admin.ui.rest;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Stream;
@ -12,7 +11,6 @@ import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import org.eclipse.microprofile.openapi.annotations.Operation;
import org.eclipse.microprofile.openapi.annotations.enums.SchemaType;
import org.eclipse.microprofile.openapi.annotations.media.Content;
@ -28,7 +26,6 @@ import org.keycloak.models.UserLoginFailureModel;
import org.keycloak.models.UserModel;
import org.keycloak.models.utils.ModelToRepresentation;
import org.keycloak.representations.idm.UserRepresentation;
import org.keycloak.services.managers.BruteForceProtector;
import org.keycloak.services.resources.admin.permissions.AdminPermissionEvaluator;
import org.keycloak.services.resources.admin.permissions.UserPermissionEvaluator;
import org.keycloak.utils.SearchQueryUtils;
@ -37,14 +34,14 @@ import org.keycloak.utils.SearchQueryUtils;
public class BruteForceUsersResource {
private static final Logger logger = Logger.getLogger(BruteForceUsersResource.class);
private static final String SEARCH_ID_PARAMETER = "id:";
@Context
private KeycloakSession session;
private final KeycloakSession session;
private final RealmModel realm;
private final AdminPermissionEvaluator auth;
public BruteForceUsersResource(RealmModel realm, AdminPermissionEvaluator auth) {
public BruteForceUsersResource(KeycloakSession session, RealmModel realm, AdminPermissionEvaluator auth) {
this.realm = realm;
this.auth = auth;
this.session = session;
}
@GET

View file

@ -30,6 +30,6 @@ public final class EffectiveRoleMappingProvider implements AdminRealmResourcePro
}
public Object getResource(KeycloakSession session, RealmModel realm, AdminPermissionEvaluator auth, AdminEventBuilder adminEvent) {
return new EffectiveRoleMappingResource(realm, auth);
return new EffectiveRoleMappingResource(session, realm, auth);
}
}

View file

@ -9,7 +9,6 @@ import javax.ws.rs.NotFoundException;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import org.eclipse.microprofile.openapi.annotations.Operation;
import org.eclipse.microprofile.openapi.annotations.enums.SchemaType;
import org.eclipse.microprofile.openapi.annotations.media.Content;
@ -25,15 +24,15 @@ import org.keycloak.models.UserModel;
import org.keycloak.services.resources.admin.permissions.AdminPermissionEvaluator;
public class EffectiveRoleMappingResource extends RoleMappingResource {
@Context
private KeycloakSession session;
private RealmModel realm;
private AdminPermissionEvaluator auth;
public EffectiveRoleMappingResource(RealmModel realm, AdminPermissionEvaluator auth) {
public EffectiveRoleMappingResource(KeycloakSession session, RealmModel realm, AdminPermissionEvaluator auth) {
super(realm, auth);
this.realm = realm;
this.auth = auth;
this.session = session;
}
@GET

View file

@ -9,7 +9,6 @@ import javax.ws.rs.DefaultValue;
import javax.ws.rs.GET;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import org.eclipse.microprofile.openapi.annotations.Operation;
import org.eclipse.microprofile.openapi.annotations.enums.SchemaType;
@ -25,15 +24,15 @@ import org.keycloak.services.resources.admin.permissions.AdminPermissionEvaluato
import org.keycloak.utils.StringUtil;
public class GroupsResource {
@Context
private KeycloakSession session;
private RealmModel realm;
private AdminPermissionEvaluator auth;
private final KeycloakSession session;
private final RealmModel realm;
private final AdminPermissionEvaluator auth;
public GroupsResource(RealmModel realm, AdminPermissionEvaluator auth) {
public GroupsResource(KeycloakSession session, RealmModel realm, AdminPermissionEvaluator auth) {
super();
this.realm = realm;
this.auth = auth;
this.session = session;
}
@GET

View file

@ -30,6 +30,6 @@ public final class GroupsResourceProvider implements AdminRealmResourceProviderF
}
public Object getResource(KeycloakSession session, RealmModel realm, AdminPermissionEvaluator auth, AdminEventBuilder adminEvent) {
return new GroupsResource(realm, auth);
return new GroupsResource(session, realm, auth);
}
}