/** * @deprecated use getActionId to get the id of the action. */ public String getAction() { return getActionId(); }
/** * Creates a unique key from the request object. * */ private String getCacheKey(final PDPRequest req) { // here we try to generate a hopefull unique "cachekey" // using the id of the user // the environment attributes, // and the the resource and action id String resource = req.getTarget().getResourceId(); String action = req.getTarget().getActionId(); String env = String.valueOf(req.getEnvironment().hashCode()); SubjectPrincipalAnalyzer principalAnalyzer = new SubjectPrincipalAnalyzer(req.getTarget().getSubject()); String userid = principalAnalyzer.getUsername(); LicenseReference licref = LicensingUtils.getLicenseReference(req.getTarget().getSubject()); String licId = licref != null ? licref.getLicenseId() : ""; if (userid == null) { userid = "#anonymous#"; } String key = new StringBuffer() .append("U:").append(userid) .append(";R:").append(resource) .append(";A:").append(action) .append(";L:").append(licId) .append(";E:").append(env).toString(); if (LOG.isTraceEnabled()) { LOG.trace("generate hash-key <" + key + "> for request <" + req + ">"); } return key; }
private RequestDocument convert52nRequestToXACMLRequest(final PDPRequest pRequest) throws XmlException { RequestDocument lDoc = RequestDocument.Factory.newInstance(); RequestType lRequest = lDoc.addNewRequest(); Target target = pRequest.getTarget(); convertEnvironmentToXACMLEnvironment(pRequest.getEnvironment(), lRequest); convertSubjectToXACMLSubject(target.getSubject(), lRequest); convertLicensePrincipalOfSubjectToXACMLEnvironment(target.getSubject(), lRequest); // todo: support complex resource and action attributes and not only id's convertResourceToXACMLResource(target.getResourceId(), lRequest); convertActionToXACMLAction(target.getActionId(), lRequest); // type is ignored ! return lDoc; }