Search in sources :

Example 6 with AttributeDesignator

use of com.sun.identity.entitlement.xacml3.core.AttributeDesignator in project OpenAM by OpenRock.

the class XACMLPrivilegeUtils method resourceNameToNotMatch.

public static Match resourceNameToNotMatch(String resourceName, String applicationName) {
    if (resourceName == null || resourceName.length() == 0) {
        return null;
    }
    Match match = new Match();
    String matchId = XACMLConstants.ENTITLEMENT_RESOURCE_NO_MATCH + ":" + applicationName;
    match.setMatchId(matchId);
    AttributeValue attributeValue = new AttributeValue();
    String dataType = XACMLConstants.XS_STRING;
    attributeValue.setDataType(dataType);
    attributeValue.getContent().add(resourceName);
    AttributeDesignator attributeDesignator = new AttributeDesignator();
    String category = XACMLConstants.XACML_RESOURCE_CATEGORY;
    attributeDesignator.setCategory(category);
    String attributeId = XACMLConstants.XACML_RESOURCE_ID;
    attributeDesignator.setAttributeId(attributeId);
    String dt = XACMLConstants.XS_STRING;
    attributeDesignator.setDataType(dt);
    // TODO: not a constant?
    String issuer = XACMLConstants.RESOURCE_ISSUER;
    // attributeDesignator.setIssuer(issuer); TODO: verify and fix
    boolean mustBePresent = true;
    attributeDesignator.setMustBePresent(mustBePresent);
    match.setAttributeValue(attributeValue);
    match.setAttributeDesignator(attributeDesignator);
    return match;
}
Also used : AttributeValue(com.sun.identity.entitlement.xacml3.core.AttributeValue) AttributeDesignator(com.sun.identity.entitlement.xacml3.core.AttributeDesignator) Match(com.sun.identity.entitlement.xacml3.core.Match)

Example 7 with AttributeDesignator

use of com.sun.identity.entitlement.xacml3.core.AttributeDesignator in project OpenAM by OpenRock.

the class XACMLPrivilegeUtils method entitlementSubjectToAnyOf.

public static AnyOf entitlementSubjectToAnyOf(EntitlementSubject es) throws JAXBException {
    if (es == null) {
        return null;
    }
    AnyOf anyOf = new AnyOf();
    List<AllOf> allOfList = anyOf.getAllOf();
    AllOf allOf = new AllOf();
    allOfList.add(allOf);
    List<Match> matchList = allOf.getMatch();
    Match match = new Match();
    matchList.add(match);
    match.setMatchId(XACMLConstants.JSON_SUBJECT_MATCH);
    AttributeValue attributeValue = new AttributeValue();
    String dataType = XACMLConstants.JSON_SUBJECT_DATATYPE + ":" + es.getClass().getName();
    attributeValue.setDataType(dataType);
    String esString = es.getState();
    attributeValue.getContent().add(esString);
    AttributeDesignator attributeDesignator = new AttributeDesignator();
    String category = XACMLConstants.XACML_ACCESS_SUBJECT_CATEGORY;
    attributeDesignator.setCategory(category);
    String attributeId = XACMLConstants.JSON_SUBJECT_ID;
    attributeDesignator.setAttributeId(attributeId);
    String dt = XACMLConstants.JSON_SUBJECT_DATATYPE + ":" + es.getClass().getName();
    attributeDesignator.setDataType(dt);
    // TODO: not a constant?
    String issuer = XACMLConstants.SUBJECT_ISSUER;
    //attributeDesignator.setIssuer(issuer); //TODO: verify and fix
    boolean mustBePresent = true;
    attributeDesignator.setMustBePresent(mustBePresent);
    match.setAttributeValue(attributeValue);
    match.setAttributeDesignator(attributeDesignator);
    return anyOf;
}
Also used : AttributeValue(com.sun.identity.entitlement.xacml3.core.AttributeValue) AttributeDesignator(com.sun.identity.entitlement.xacml3.core.AttributeDesignator) AnyOf(com.sun.identity.entitlement.xacml3.core.AnyOf) AllOf(com.sun.identity.entitlement.xacml3.core.AllOf) Match(com.sun.identity.entitlement.xacml3.core.Match)

Aggregations

AttributeDesignator (com.sun.identity.entitlement.xacml3.core.AttributeDesignator)7 AttributeValue (com.sun.identity.entitlement.xacml3.core.AttributeValue)7 Match (com.sun.identity.entitlement.xacml3.core.Match)7 AllOf (com.sun.identity.entitlement.xacml3.core.AllOf)3 AnyOf (com.sun.identity.entitlement.xacml3.core.AnyOf)3 UserSubject (com.sun.identity.entitlement.UserSubject)1 ArrayList (java.util.ArrayList)1 JSONObject (org.json.JSONObject)1