diff --git a/services/src/main/java/org/keycloak/services/resources/PublicRealmResource.java b/services/src/main/java/org/keycloak/services/resources/PublicRealmResource.java index ab12f38295..7085eab839 100755 --- a/services/src/main/java/org/keycloak/services/resources/PublicRealmResource.java +++ b/services/src/main/java/org/keycloak/services/resources/PublicRealmResource.java @@ -41,7 +41,7 @@ public class PublicRealmResource { @NoCache @Produces("application/json") public PublishedRealmRepresentation getRealm(@PathParam("realm") String id) { - return new Transaction() { + return new Transaction() { protected PublishedRealmRepresentation callImpl() { return realmRep(realm, uriInfo); } @@ -53,7 +53,7 @@ public class PublicRealmResource { @Path("html") @Produces("text/html") public String getRealmHtml(@PathParam("realm") String id) { - return new Transaction() { + return new Transaction() { protected String callImpl() { StringBuffer html = new StringBuffer(); diff --git a/services/src/main/java/org/keycloak/services/resources/RealmsResource.java b/services/src/main/java/org/keycloak/services/resources/RealmsResource.java index 9f626a4f6e..3a4fa57609 100755 --- a/services/src/main/java/org/keycloak/services/resources/RealmsResource.java +++ b/services/src/main/java/org/keycloak/services/resources/RealmsResource.java @@ -53,7 +53,7 @@ public class RealmsResource { @Path("{realm}/tokens") public TokenService getTokenService(final @PathParam("realm") String id) { - return new Transaction(false) { + return new Transaction(false) { @Override protected TokenService callImpl() { RealmManager realmManager = new RealmManager(session); @@ -72,7 +72,7 @@ public class RealmsResource { @Path("{realm}") public PublicRealmResource getRealmResource(final @PathParam("realm") String id) { - return new Transaction(false) { + return new Transaction(false) { @Override protected PublicRealmResource callImpl() { RealmManager realmManager = new RealmManager(session); diff --git a/services/src/main/java/org/keycloak/services/resources/SaasService.java b/services/src/main/java/org/keycloak/services/resources/SaasService.java index b472e87fd9..e969d7e05d 100755 --- a/services/src/main/java/org/keycloak/services/resources/SaasService.java +++ b/services/src/main/java/org/keycloak/services/resources/SaasService.java @@ -79,7 +79,7 @@ public class SaasService { @NoCache public Response keepalive(final @Context HttpHeaders headers) { logger.info("keepalive"); - return new Transaction() { + return new Transaction() { @Override public Response callImpl() { RealmManager realmManager = new RealmManager(session); @@ -101,7 +101,7 @@ public class SaasService { @Produces("application/json") @NoCache public Response whoAmI(final @Context HttpHeaders headers) { - return new Transaction() { + return new Transaction() { @Override public Response callImpl() { RealmManager realmManager = new RealmManager(session); @@ -122,7 +122,7 @@ public class SaasService { @Produces("application/javascript") @NoCache public String isLoggedIn(final @Context HttpHeaders headers) { - return new Transaction() { + return new Transaction() { @Override public String callImpl() { logger.info("WHOAMI Javascript start."); @@ -152,7 +152,7 @@ public class SaasService { @Path("admin/realms") public RealmsAdminResource getRealmsAdmin(@Context final HttpHeaders headers) { - return new Transaction(false) { + return new Transaction(false) { @Override protected RealmsAdminResource callImpl() { RealmManager realmManager = new RealmManager(session); @@ -239,7 +239,7 @@ public class SaasService { @Consumes(MediaType.APPLICATION_FORM_URLENCODED) public Response processLogin(final MultivaluedMap formData) { logger.info("processLogin start"); - return new Transaction() { + return new Transaction() { @Override protected Response callImpl() { RealmManager realmManager = new RealmManager(session); @@ -283,7 +283,7 @@ public class SaasService { @POST @Consumes(MediaType.APPLICATION_JSON) public Response register(final UserRepresentation newUser) { - return new Transaction() { + return new Transaction() { @Override protected Response callImpl() { RealmManager realmManager = new RealmManager(session); @@ -302,7 +302,7 @@ public class SaasService { @POST @Consumes(MediaType.APPLICATION_FORM_URLENCODED) public Response processRegister(final MultivaluedMap formData) { - return new Transaction() { + return new Transaction() { @Override protected Response callImpl() { RealmManager realmManager = new RealmManager(session); diff --git a/services/src/main/java/org/keycloak/services/resources/SocialResource.java b/services/src/main/java/org/keycloak/services/resources/SocialResource.java index ef4b2d9926..35d625a57e 100644 --- a/services/src/main/java/org/keycloak/services/resources/SocialResource.java +++ b/services/src/main/java/org/keycloak/services/resources/SocialResource.java @@ -91,7 +91,7 @@ public class SocialResource { @GET @Path("callback") public Response callback() throws URISyntaxException { - return new Transaction() { + return new Transaction() { protected Response callImpl() { Map queryParams = getQueryParams(); diff --git a/services/src/main/java/org/keycloak/services/resources/TokenService.java b/services/src/main/java/org/keycloak/services/resources/TokenService.java index 6068d2e269..7488fe1685 100755 --- a/services/src/main/java/org/keycloak/services/resources/TokenService.java +++ b/services/src/main/java/org/keycloak/services/resources/TokenService.java @@ -118,7 +118,7 @@ public class TokenService { @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Produces(MediaType.APPLICATION_JSON) public Response grantIdentityToken(final MultivaluedMap form) { - return new Transaction() { + return new Transaction() { protected Response callImpl() { String username = form.getFirst(AuthenticationManager.FORM_USERNAME); if (username == null) { @@ -151,7 +151,7 @@ public class TokenService { @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Produces(MediaType.APPLICATION_JSON) public Response grantAccessToken(final MultivaluedMap form) { - return new Transaction() { + return new Transaction() { protected Response callImpl() { String username = form.getFirst(AuthenticationManager.FORM_USERNAME); if (username == null) { @@ -185,7 +185,7 @@ public class TokenService { public Response processLogin(@QueryParam("client_id") final String clientId, @QueryParam("scope") final String scopeParam, @QueryParam("state") final String state, @QueryParam("redirect_uri") final String redirect, final MultivaluedMap formData) { - return new Transaction() { + return new Transaction() { protected Response callImpl() { OAuthFlows oauth = Flows.oauth(realm, request, uriInfo, authManager, tokenManager); @@ -229,7 +229,7 @@ public class TokenService { public Response processRegister(@QueryParam("client_id") final String clientId, @QueryParam("scope") final String scopeParam, @QueryParam("state") final String state, @QueryParam("redirect_uri") final String redirect, final MultivaluedMap formData) { - return new Transaction() { + return new Transaction() { @Override protected Response callImpl() { OAuthFlows oauth = Flows.oauth(realm, request, uriInfo, authManager, tokenManager); @@ -310,7 +310,7 @@ public class TokenService { @POST @Produces("application/json") public Response accessCodeToToken(final MultivaluedMap formData) { - return new Transaction() { + return new Transaction() { protected Response callImpl() { logger.info("accessRequest <---"); if (!realm.isEnabled()) { @@ -438,7 +438,7 @@ public class TokenService { public Response loginPage(final @QueryParam("response_type") String responseType, final @QueryParam("redirect_uri") String redirect, final @QueryParam("client_id") String clientId, final @QueryParam("scope") String scopeParam, final @QueryParam("state") String state) { - return new Transaction() { + return new Transaction() { protected Response callImpl() { OAuthFlows oauth = Flows.oauth(realm, request, uriInfo, authManager, tokenManager); @@ -486,7 +486,7 @@ public class TokenService { public Response registerPage(final @QueryParam("response_type") String responseType, final @QueryParam("redirect_uri") String redirect, final @QueryParam("client_id") String clientId, final @QueryParam("scope") String scopeParam, final @QueryParam("state") String state) { - return new Transaction() { + return new Transaction() { protected Response callImpl() { OAuthFlows oauth = Flows.oauth(realm, request, uriInfo, authManager, tokenManager); @@ -517,7 +517,7 @@ public class TokenService { @GET @NoCache public Response logout(final @QueryParam("redirect_uri") String redirectUri) { - return new Transaction() { + return new Transaction() { protected Response callImpl() { // todo do we care if anybody can trigger this? @@ -537,7 +537,7 @@ public class TokenService { @POST @Consumes(MediaType.APPLICATION_FORM_URLENCODED) public Response processOAuth(final MultivaluedMap formData) { - return new Transaction() { + return new Transaction() { protected Response callImpl() { OAuthFlows oauth = Flows.oauth(realm, request, uriInfo, authManager, tokenManager); diff --git a/services/src/main/java/org/keycloak/services/resources/Transaction.java b/services/src/main/java/org/keycloak/services/resources/Transaction.java index 32f4319d1b..d88cc050b7 100755 --- a/services/src/main/java/org/keycloak/services/resources/Transaction.java +++ b/services/src/main/java/org/keycloak/services/resources/Transaction.java @@ -13,7 +13,7 @@ import javax.ws.rs.core.Application; * @author Bill Burke * @version $Revision: 1 $ */ -public class Transaction { +public class Transaction { protected KeycloakSession session; protected KeycloakTransaction transaction; protected boolean closeSession; @@ -83,7 +83,7 @@ public class Transaction { } } - protected T callImpl() { + protected T callImpl() { return null; } @@ -91,7 +91,7 @@ public class Transaction { * Will not begin or end a transaction or close a session if the transaction was already active when called * */ - public T call() { + public T call() { boolean wasActive = transaction.isActive(); if (!wasActive) transaction.begin(); try { diff --git a/services/src/main/java/org/keycloak/services/resources/admin/ApplicationResource.java b/services/src/main/java/org/keycloak/services/resources/admin/ApplicationResource.java index 35038d2984..36540ac1b1 100755 --- a/services/src/main/java/org/keycloak/services/resources/admin/ApplicationResource.java +++ b/services/src/main/java/org/keycloak/services/resources/admin/ApplicationResource.java @@ -36,7 +36,7 @@ public class ApplicationResource { @PUT @Consumes(MediaType.APPLICATION_JSON) public void update(final ApplicationRepresentation rep) { - new Transaction() { + new Transaction() { @Override protected void runImpl() { ResourceManager resourceManager = new ResourceManager(new RealmManager(session)); @@ -50,7 +50,7 @@ public class ApplicationResource { @NoCache @Produces(MediaType.APPLICATION_JSON) public ApplicationRepresentation getResource(final @PathParam("id") String id) { - return new Transaction() { + return new Transaction() { @Override protected ApplicationRepresentation callImpl() { ResourceManager resourceManager = new ResourceManager(new RealmManager(session)); diff --git a/services/src/main/java/org/keycloak/services/resources/admin/ApplicationsResource.java b/services/src/main/java/org/keycloak/services/resources/admin/ApplicationsResource.java index e7496af971..9be8bbdc7e 100755 --- a/services/src/main/java/org/keycloak/services/resources/admin/ApplicationsResource.java +++ b/services/src/main/java/org/keycloak/services/resources/admin/ApplicationsResource.java @@ -42,7 +42,7 @@ public class ApplicationsResource { @Produces(MediaType.APPLICATION_JSON) @NoCache public List getResources() { - return new Transaction() { + return new Transaction>() { @Override protected List callImpl() { List rep = new ArrayList(); @@ -59,7 +59,7 @@ public class ApplicationsResource { @POST @Consumes(MediaType.APPLICATION_JSON) public Response createResource(final @Context UriInfo uriInfo, final ApplicationRepresentation rep) { - return new Transaction() { + return new Transaction() { @Override protected Response callImpl() { ResourceManager resourceManager = new ResourceManager(new RealmManager(session)); @@ -71,7 +71,7 @@ public class ApplicationsResource { @Path("{id}") public ApplicationResource getResource(final @PathParam("id") String id) { - return new Transaction(false) { + return new Transaction(false) { @Override protected ApplicationResource callImpl() { ApplicationModel applicationModel = realm.getApplicationById(id); diff --git a/services/src/main/java/org/keycloak/services/resources/admin/RealmAdminResource.java b/services/src/main/java/org/keycloak/services/resources/admin/RealmAdminResource.java index 539d34bc04..c8309cbd1e 100755 --- a/services/src/main/java/org/keycloak/services/resources/admin/RealmAdminResource.java +++ b/services/src/main/java/org/keycloak/services/resources/admin/RealmAdminResource.java @@ -49,7 +49,7 @@ public class RealmAdminResource { @NoCache @Produces("application/json") public RealmRepresentation getRealm() { - return new Transaction() { + return new Transaction() { @Override protected RealmRepresentation callImpl() { return new RealmManager(session).toRepresentation(realm); @@ -63,7 +63,7 @@ public class RealmAdminResource { @NoCache @Produces("application/json") public List getRoles() { - return new Transaction() { + return new Transaction>() { @Override protected List callImpl() { List roleModels = realm.getRoles(); @@ -95,7 +95,7 @@ public class RealmAdminResource { @NoCache @Produces("application/json") public RoleRepresentation getRole(final @PathParam("id") String id) { - return new Transaction() { + return new Transaction() { @Override protected RoleRepresentation callImpl() { RoleModel roleModel = realm.getRoleById(id); @@ -132,7 +132,7 @@ public class RealmAdminResource { @POST @Consumes("application/json") public Response createRole(final @Context UriInfo uriInfo, final RoleRepresentation rep) { - return new Transaction() { + return new Transaction() { @Override protected Response callImpl() { if (realm.getRole(rep.getName()) != null) { diff --git a/services/src/main/java/org/keycloak/services/resources/admin/RealmsAdminResource.java b/services/src/main/java/org/keycloak/services/resources/admin/RealmsAdminResource.java index fd5485a507..1082f69a04 100755 --- a/services/src/main/java/org/keycloak/services/resources/admin/RealmsAdminResource.java +++ b/services/src/main/java/org/keycloak/services/resources/admin/RealmsAdminResource.java @@ -54,7 +54,7 @@ public class RealmsAdminResource { @NoCache @Produces("application/json") public List getRealms() { - return new Transaction() { + return new Transaction>() { @Override protected List callImpl() { logger.info(("getRealms()")); @@ -81,7 +81,7 @@ public class RealmsAdminResource { @Consumes("application/json") public Response importRealm(@Context final UriInfo uriInfo, final RealmRepresentation rep) { logger.info("importRealm: " + rep.getRealm()); - return new Transaction() { + return new Transaction() { @Override protected Response callImpl() { RealmManager realmManager = new RealmManager(session); @@ -96,7 +96,7 @@ public class RealmsAdminResource { @Path("{id}") public RealmAdminResource getRealmAdmin(@Context final HttpHeaders headers, @PathParam("id") final String id) { - return new Transaction(false) { + return new Transaction(false) { @Override protected RealmAdminResource callImpl() { RealmManager realmManager = new RealmManager(session);