public Object transform(final Object input) { PDPRequest request = (PDPRequest) input; orgRequests.add(request); try { return convert52nRequestToXACMLRequest(request); } catch (XmlException e) { throw new DecisionProcessingException("can't convert pdp request: " + e, e); } } });
public List getPermissions(Target pTarget) throws DecisionProcessingException { Iterator principalIterator = pTarget.getSubject().getPrincipals( UsernameIDPrincipal.class).iterator(); UsernameIDPrincipal userNameIDprincipal = (UsernameIDPrincipal) principalIterator.next(); if (userNameIDprincipal == null) { throw new DecisionProcessingException( "Subject for PDP request contains no username or id"); } String lSubject = userNameIDprincipal.getName(); return getPermissions(lSubject, pTarget.getAction(), pTarget.getResource()); }
/** * This mehtod requests a licensemanager to resolve the license. * * @see LicenseResolver#resolveLicense(LicenseReference) */ public LicenseType resolveLicense(final LicenseReference licenseReference) { if (LOG.isTraceEnabled()) { LOG.trace("LicenseManagerLicenseResolver.resolveLicense(" + licenseReference + ")"); } String licenseManagerUrl = licenseReference.getLicenseManagerUrl(); if (licenseManagerUrl == null || licenseManagerUrl.isEmpty()) { licenseManagerUrl = defaultLicenseManagerUrl; } LicenseManagerClient licMgrClient = new LicenseManagerClient(licenseManagerUrl); try { return licMgrClient.getLicense(licenseReference.getLicenseId()); } catch (LicenseManagerClientException e) { throw new DecisionProcessingException("can't obtain license from licensemanager service: " + e, e); } }
public ResponseDocument executeRequest(RequestDocument request) throws DecisionProcessingException { Document responseDoc; try { responseDoc = getDecisionServiceAdapter().evaluate((Document) request.getDomNode()); // The commented version is 50 per cent faster but fails with Xalan, // so we convert everything into byte[] :( ByteArrayOutputStream outStream = new ByteArrayOutputStream(); DOMSerializer.createNew().serialize(responseDoc, outStream); //return ResponseDocument.Factory.parse(responseDoc); return ResponseDocument.Factory.parse(new ByteArrayInputStream(outStream.toByteArray())); } catch (Exception e) { throw new DecisionProcessingException("Could not evaluate PolicyRequest.", e); } }
notBefore.setTimeInMillis(notBefore.getTimeInMillis() - timeDelta); if (actualDate.before(notBefore)) { throw new DecisionProcessingException("Rejecting license since it cannot be applied before <" + conditions.getNotBefore().getTime() + ">"); notOnOrAfter.setTimeInMillis(notOnOrAfter.getTimeInMillis() + timeDelta); if (actualDate.equals(notOnOrAfter) || actualDate.after(notOnOrAfter)) { throw new DecisionProcessingException("Rejecting license since it cannot be applied on or after <" + conditions.getNotOnOrAfter().getTime() + ">");
throw new DecisionProcessingException("Subject for PDP request contains no principal"); throw new DecisionProcessingException("Target must specify a PermissionCollection type");
public Element evaluate(final Element request) { Element requestWithoutDefaultNS = new XMLPrefixRemover().removePrefixes(request); try { RequestCtx requestCtx = RequestCtx.getInstance(requestWithoutDefaultNS); ResponseCtx response = getPdp().evaluate(requestCtx); return toElement(response); } catch (ParsingException e) { throw new DecisionProcessingException(e); } }
throw new DecisionProcessingException("PDP Service returned fault (httpcode:" + httpResponse.getStatus().getCode() + " msg:" + msg); throw (DecisionProcessingException) e; throw new DecisionProcessingException("Can't communicate with PDP:" + e, e);
throw new DecisionProcessingException("can't read policyset within license: " + e, e);