public Builder requestAttribute(String attributeName, Object attributeValue) { if (obj.requestContext != null) { throw new IllegalStateException("requestContext has been set already!"); } if (this.requestAttributes == null) { this.requestAttributes = new DefaultRequestAttributes(); } this.requestAttributes.setAttribute(attributeName, attributeValue); return this; }
private RequestContext createPolicyReq() { RequestAttributes attribs = new DefaultRequestAttributes(); attribs.setAttribute(AuthzConstants.ATTR_REQUEST_CONTEXT, ctxToAuthorize); attribs.setAttribute(AuthzConstants.ATTR_REQUEST_RESOURCE_STATE, reqStateToAuthorize); attribs.setAttribute(AuthzConstants.ATTR_RESPONSE_RESOURCE_STATE, respStateToAuthorize); return new RequestContext.Builder().requestAttributes(attribs).build(); }
@Override public Map<String, ?> properties(RequestContext ctx) throws Exception { // determine table names List<String> tables = catalog().tableIds(); // store to ctx attributes to pass on to readMembers ctx.requestAttributes().setAttribute(TABLE_NAMES, tables); List<Resource> links = new LinkedList<>(); MapResource batch = new MapResource(); batch.put("rel", "batch"); batch.put(LiveOak.HREF, uri() + "/" + BATCH_ENDPOINT); links.add(batch); Map<String, Object> result = new HashMap<>(); result.put("links", links); // here only set num of tables as size result.put("count", tables.size()); // maybe some other things to do with db as a whole result.put("type", "database"); return result; }
attribs.setAttribute(AuthzConstants.ATTR_REQUEST_CONTEXT, reqContext); attribs.setAttribute(AuthzConstants.ATTR_RESPONSE_RESOURCE_STATE, origResourceResponse.state());
.securityContext(securityContext); RequestAttributes attribs = new DefaultRequestAttributes(); attribs.setAttribute(AuthzConstants.ATTR_REQUEST_CONTEXT, reqToAuthorize); attribs.setAttribute(AuthzConstants.ATTR_RESPONSE_RESOURCE_STATE, childState); RequestContext authzRequest = new RequestContext.Builder().requestAttributes(attribs).build();
attribs.setAttribute(AuthzConstants.ATTR_REQUEST_CONTEXT, req.requestContext()); attribs.setAttribute(AuthzConstants.ATTR_REQUEST_RESOURCE_STATE, req.state()); RequestContext authzRequest = new RequestContext.Builder().requestAttributes(attribs).build();