/** * Utility function to add an attribute to the hash digest. * * @param a * the attribute to hash */ private static void hashAttribute(Attribute a, MessageDigest dig) { dig.update(a.getId().toString().getBytes()); dig.update(a.getType().toString().getBytes()); dig.update(a.getValue().encode().getBytes()); if (a.getIssuer() != null) { dig.update(a.getIssuer().getBytes()); } if (a.getIssueInstant() != null) { dig.update(a.getIssueInstant().encode().getBytes()); } }
/** * Changes the value of the resource-id attribute in this context. This * is useful when you have multiple resources (ie, a scope other than * IMMEDIATE), and you need to keep changing only the resource-id to * evaluate the different effective requests. * * @param resourceId the new resource-id value */ public void setResourceId(AttributeValue resourceId) { this.resourceId = resourceId; // there will always be exactly one value for this attribute Collection attrSet = (Collection)(resourceMap.get(RESOURCE_ID)); Attribute attr = (Attribute)(attrSet.iterator().next()); // remove the old value... attrSet.remove(attr); // ...and insert the new value attrSet.add(new SingletonAttribute(attr.getId(), attr.getIssuer(), attr.getIssueInstant(), resourceId)); }
/** * Changes the value of the resource-id attribute in this context. This * is useful when you have multiple resources (ie, a scope other than * IMMEDIATE), and you need to keep changing only the resource-id to * evaluate the different effective requests. * * @param resourceId the new resource-id value */ public void setResourceId(AttributeValue resourceId) { this.resourceId = resourceId; // there will always be exactly one value for this attribute Collection attrSet = (Collection)(resourceMap.get(RESOURCE_ID)); Attribute attr = (Attribute)(attrSet.iterator().next()); // remove the old value... attrSet.remove(attr); // ...and insert the new value attrSet.add(new SingletonAttribute(attr.getId(), attr.getIssuer(), attr.getIssueInstant(), resourceId)); }