public void init() throws GeneralException { newPdp(); }
@Override public void inactivate() { destroy(); }
@Override public void encode(OutputStream output, Indenter indenter) { encode(output, indenter, null); }
@Before public void setUp() throws ParsingException{ List<Subject> subjects = Collections.singletonList(mockSubject); List<Attribute> action = Collections.emptyList(); List<Attribute> environment = Collections.emptyList(); List<Attribute> resource = Arrays.asList(new Attribute[]{ AbstractPolicyEnforcementPoint.RESOURCE_ATTRIBUTE, new SingletonAttribute(Constants.OBJECT.PID.attributeId, null, null, new StringAttribute("lol:wut")) }); RequestCtx request = new BasicRequestCtx(subjects, resource, action, environment); test = new BasicEvaluationCtx(request, mockFinder, mockContext); }
/** * Creates a new <code>RequestCtx</code> by parsing XML from an * input stream. Note that this a convenience method, and it will * not do schema validation by default. You should be parsing the data * yourself, and then providing the root node to the other * <code>getInstance</code> method. If you use this convenience * method, you probably want to turn on validation by setting the * context schema file (see the programmer guide for more information * on this). * * @param input a stream providing the XML data * * @return a new <code>RequestCtx</code> * * @throws ParsingException if there is an error parsing the input */ public static RequestCtx getInstance(InputStream input) throws ParsingException { return getInstance(InputParser.parseInput(input, "Request")); }
public static junit.framework.Test suite() throws Exception { junit.framework.TestSuite suite = new junit.framework.TestSuite(AllUnitTests.class.getName()); suite.addTest(TestBasicEvaluationContext.suite()); suite.addTest(TestAttributeImpls.suite()); suite.addTest(TestBasicRequestCtx.suite()); return suite; } }
/** * Returns attribute value(s) from the action section of the request. * * @param type the type of the attribute value(s) to find * @param id the id of the attribute value(s) to find * @param issuer the issuer of the attribute value(s) to find or null * * @return a result containing a bag either empty because no values were * found or containing at least one value, or status associated with an * Indeterminate result */ public EvaluationResult getActionAttribute(URI type, URI id, URI issuer) { return getGenericAttributes(type, id, issuer, actionMap, null, AttributeDesignator.ACTION_TARGET); }
/** * Returns attribute value(s) from the subject section of the request * that have no issuer. * * @param type the type of the attribute value(s) to find * @param id the id of the attribute value(s) to find * @param category the category the attribute value(s) must be in * * @return a result containing a bag either empty because no values were * found or containing at least one value, or status associated with an * Indeterminate result */ public EvaluationResult getSubjectAttribute(URI type, URI id, URI category) { return getSubjectAttribute(type, id, null, category); }
@Override public void encode(OutputStream output) { encode(output, new Indenter(0)); }
/** * Creates a new <code>RequestCtx</code> by parsing XML from an * input stream. Note that this a convenience method, and it will * not do schema validation by default. You should be parsing the data * yourself, and then providing the root node to the other * <code>getInstance</code> method. If you use this convenience * method, you probably want to turn on validation by setting the * context schema file (see the programmer guide for more information * on this). * * @param input a stream providing the XML data * * @return a new <code>RequestCtx</code> * * @throws ParsingException if there is an error parsing the input */ public static RequestCtx getInstance(InputStream input) throws ParsingException { return getInstance(InputParser.parseInput(input, "Request")); }
@Override public void encode(OutputStream output, Indenter indenter) { encode(output, indenter, null); }
/** * Returns attribute value(s) from the resource section of the request. * * @param type the type of the attribute value(s) to find * @param id the id of the attribute value(s) to find * @param issuer the issuer of the attribute value(s) to find or null * * @return a result containing a bag either empty because no values were * found or containing at least one value, or status associated with an * Indeterminate result */ public EvaluationResult getResourceAttribute(URI type, URI id, URI issuer) { return getGenericAttributes(type, id, issuer, resourceMap, null, AttributeDesignator.RESOURCE_TARGET); }
public void init() throws GeneralException { newPdp(); }
@Override public void inactivate() { destroy(); }
/** * Returns attribute value(s) from the subject section of the request * that have no issuer. * * @param type the type of the attribute value(s) to find * @param id the id of the attribute value(s) to find * @param category the category the attribute value(s) must be in * * @return a result containing a bag either empty because no values were * found or containing at least one value, or status associated with an * Indeterminate result */ public EvaluationResult getSubjectAttribute(URI type, URI id, URI category) { return getSubjectAttribute(type, id, null, category); }
/** * Simple encoding method that returns the text-encoded version of * this attribute with no formatting. * * @return the text-encoded XML */ @Override public String encode() { ReadableByteArrayOutputStream out = new ReadableByteArrayOutputStream(); encode(out); return out.toString(); }
/** * Returns attribute value(s) from the environment section of the request. * * @param type the type of the attribute value(s) to find * @param id the id of the attribute value(s) to find * @param issuer the issuer of the attribute value(s) to find or null * * @return a result containing a bag either empty because no values were * found or containing at least one value, or status associated with an * Indeterminate result */ public EvaluationResult getEnvironmentAttribute(URI type, URI id, URI issuer) { return getGenericAttributes(type, id, issuer, environmentMap, null, AttributeDesignator.ENVIRONMENT_TARGET); }
/** * Returns attribute value(s) from the action section of the request. * * @param type the type of the attribute value(s) to find * @param id the id of the attribute value(s) to find * @param issuer the issuer of the attribute value(s) to find or null * * @return a result containing a bag either empty because no values were * found or containing at least one value, or status associated with an * Indeterminate result */ public EvaluationResult getActionAttribute(URI type, URI id, URI issuer) { return getGenericAttributes(type, id, issuer, actionMap, null, AttributeDesignator.ACTION_TARGET); }
/** * Returns attribute value(s) from the environment section of the request. * * @param type the type of the attribute value(s) to find * @param id the id of the attribute value(s) to find * @param issuer the issuer of the attribute value(s) to find or null * * @return a result containing a bag either empty because no values were * found or containing at least one value, or status associated with an * Indeterminate result */ public EvaluationResult getEnvironmentAttribute(URI type, URI id, URI issuer) { return getGenericAttributes(type, id, issuer, environmentMap, null, AttributeDesignator.ENVIRONMENT_TARGET); }
/** * Returns attribute value(s) from the resource section of the request. * * @param type the type of the attribute value(s) to find * @param id the id of the attribute value(s) to find * @param issuer the issuer of the attribute value(s) to find or null * * @return a result containing a bag either empty because no values were * found or containing at least one value, or status associated with an * Indeterminate result */ public EvaluationResult getResourceAttribute(URI type, URI id, URI issuer) { return getGenericAttributes(type, id, issuer, resourceMap, null, AttributeDesignator.RESOURCE_TARGET); }