RealmContextFilter.java revision 16682c615640da7d54591f86528a5eb562e0ab97
/*
* The contents of this file are subject to the terms of the Common Development and
* Distribution License (the License). You may not use this file except in compliance with the
* License.
*
* You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
* specific language governing permission and limitations under the License.
*
* When distributing Covered Software, include this CDDL Header Notice in each file and include
* the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
* Header, with the fields enclosed by brackets [] replaced by your own identifying
* information: "Portions copyright [year] [name of copyright owner]".
*
* Copyright 2015 ForgeRock AS.
*/
/**
* Filter which will consume the realm part of the request URI and inject a
* {@link RealmContext} into the {@link Context} hierarchy.
*
* @since 13.0.0
*/
private final CoreWrapper coreWrapper;
private final RestRealmValidator realmValidator;
this.coreWrapper = coreWrapper;
this.realmValidator = realmValidator;
}
public Promise<Response, NeverThrowsException> filter(Context context, Request request, Handler next) {
try {
} catch (BadRequestException e ) {
} catch (ResourceException e) {
return newResultPromise(new Response(Status.INTERNAL_SERVER_ERROR).setEntity(e.toJsonValue().getObject()));
}
}
public Promise<ActionResponse, ResourceException> filterAction(Context context, ActionRequest request,
try {
} catch (ResourceException e) {
return newExceptionPromise(e);
}
}
public Promise<ResourceResponse, ResourceException> filterCreate(Context context, CreateRequest request,
try {
} catch (ResourceException e) {
return newExceptionPromise(e);
}
}
public Promise<ResourceResponse, ResourceException> filterDelete(Context context, DeleteRequest request,
try {
} catch (ResourceException e) {
return newExceptionPromise(e);
}
}
public Promise<ResourceResponse, ResourceException> filterPatch(Context context, PatchRequest request,
try {
} catch (ResourceException e) {
return newExceptionPromise(e);
}
}
try {
} catch (ResourceException e) {
return newExceptionPromise(e);
}
}
public Promise<ResourceResponse, ResourceException> filterRead(Context context, ReadRequest request,
try {
} catch (ResourceException e) {
return newExceptionPromise(e);
}
}
public Promise<ResourceResponse, ResourceException> filterUpdate(Context context, UpdateRequest request,
try {
} catch (ResourceException e) {
return newExceptionPromise(e);
}
}
}
private Context evaluate(Context context, org.forgerock.json.resource.Request request) throws ResourceException {
}
int consumedElementsCount = 0;
try {
} catch (InternalServerErrorException ignored) {
break;
}
}
try {
}
} catch (InternalServerErrorException e) {
}
return realmContext;
}
}
}
return realm;
}
throws InternalServerErrorException {
// Ignoring parentRealm here as a realm alias is only applicable if it is from the root realm
}
return realm;
}
}
private String getRealmFromAlias(SSOToken adminToken, String realmAlias) throws InternalServerErrorException {
try {
} catch (IdRepoException | SSOException e) {
throw new InternalServerErrorException(e);
}
}
List<String> matchedUri = Paths.getPathElements(context.asContext(UriRouterContext.class).getBaseUri());
}
return path;
}
}