Examples of InvalidRequestException


Examples of org.jboss.seam.security.external.InvalidRequestException

            DocumentBuilder builder = factory.newDocumentBuilder();
            return builder.parse(is);
        } catch (ParserConfigurationException e) {
            throw new RuntimeException(e);
        } catch (SAXException e) {
            throw new InvalidRequestException("SAML request could not be parsed", e);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
View Full Code Here

Examples of org.jboss.seam.security.external.InvalidRequestException

    public void processIDPResponse(HttpServletRequest httpRequest, HttpServletResponse httpResponse, StatusResponseType statusResponse) throws InvalidRequestException {
        SamlExternalIdentityProvider idp = (SamlExternalIdentityProvider) samlDialogue.getExternalProvider();

        StatusType status = statusResponse.getStatus();
        if (status == null) {
            throw new InvalidRequestException("Response does not contain a status");
        }

        String statusValue = status.getStatusCode().getValue();
        if (!SamlConstants.STATUS_SUCCESS.equals(statusValue)) {
            String statusCodeLevel1 = statusValue;
            String statusCodeLevel2 = null;
            if (status.getStatusCode().getStatusCode() != null) {
                statusCodeLevel2 = status.getStatusCode().getStatusCode().getValue();
            }
            samlServiceProviderSpi.get().loginFailed(statusCodeLevel1, statusCodeLevel2, responseHandler.createResponseHolder(httpResponse));
        }

        if (!(statusResponse instanceof ResponseType)) {
            throw new InvalidRequestException("Response does not have type ResponseType");
        }

        ResponseType response = (ResponseType) statusResponse;

        List<Object> assertions = response.getAssertionOrEncryptedAssertion();
        if (assertions.size() == 0) {
            throw new RuntimeException("IDP response does not contain assertions");
        }

        SamlSpSessionImpl session = createSession(response, idp);
        if (session == null) {
            throw new InvalidRequestException("Not possible to login based on the supplied assertions");
        } else {
            session.setIdentityProvider(idp);
            loginUser(httpRequest, httpResponse, session, statusResponse.getInResponseTo() == null, httpRequest.getParameter(SamlRedirectMessage.QSP_RELAY_STATE));
        }
View Full Code Here

Examples of org.jboss.seam.security.external.InvalidRequestException

    }

    public void validateSignature(Key publicKey, Document signedDoc) throws InvalidRequestException {
        NodeList nl = signedDoc.getElementsByTagNameNS(XMLSignature.XMLNS, "Signature");
        if (nl == null || nl.getLength() == 0) {
            throw new InvalidRequestException("Signature element is not present or has zero length.");
        }

        try {
            DOMValidateContext valContext = new DOMValidateContext(publicKey, nl.item(0));
            XMLSignature signature = fac.unmarshalXMLSignature(valContext);
            boolean signatureValid = signature.validate(valContext);

            if (log.isTraceEnabled() && !signatureValid) {
                boolean sv = signature.getSignatureValue().validate(valContext);
                log.trace("Signature validation status: " + sv);

                @SuppressWarnings("unchecked")
                List<Reference> references = signature.getSignedInfo().getReferences();
                for (Reference ref : references) {
                    log.trace("[Ref id=" + ref.getId() + ":uri=" + ref.getURI() + "] validity status:" + ref.validate(valContext));
                }
            }

            if (!signatureValid) {
                throw new InvalidRequestException("Invalid signature.");
            }
        } catch (XMLSignatureException e) {
            throw new RuntimeException(e);
        } catch (MarshalException e) {
            throw new RuntimeException(e);
View Full Code Here

Examples of org.jboss.seam.security.external.InvalidRequestException

    @Inject
    private ResponseHandler responseHandler;

    public void processSPRequest(HttpServletRequest httpRequest, HttpServletResponse httpResponse, RequestAbstractType request) throws InvalidRequestException {
        if (!(request instanceof AuthnRequestType)) {
            throw new InvalidRequestException("Request should be an authentication request.");
        }

        samlIdentityProviderSpi.get().authenticate(responseHandler.createResponseHolder(httpResponse));
    }
View Full Code Here

Examples of org.jboss.seam.security.external.InvalidRequestException

    @Inject
    private ResponseHandler responseHandler;

    public void processSPRequest(HttpServletRequest httpRequest, HttpServletResponse httpResponse, RequestAbstractType request) throws InvalidRequestException {
        if (!(request instanceof LogoutRequestType)) {
            throw new InvalidRequestException("Request should be a single logout request.");
        }

        LogoutRequestType logoutRequest = (LogoutRequestType) request;

        NameIDType nameIdJaxb = logoutRequest.getNameID();
View Full Code Here

Examples of org.openbravo.service.web.InvalidRequestException

        if (firstResult != null) {
          try {
            obq.setFirstResult(Integer.parseInt(firstResult));
          } catch (NumberFormatException e) {
            throw new InvalidRequestException("Value of firstResult parameter is not an integer: "
                + firstResult);
          }
        }
        if (maxResult != null) {
          try {
            obq.setMaxResult(Integer.parseInt(maxResult));
          } catch (NumberFormatException e) {
            throw new InvalidRequestException("Value of maxResult parameter is not an integer: "
                + firstResult);
          }
        }

        if (countOperation) {
View Full Code Here

Examples of org.restsql.core.InvalidRequestException

    String uri;
    try {
      uri = URLDecoder.decode(httpAttributes.getUri(), "UTF-8");
    } catch (final UnsupportedEncodingException exception) {
      throw new InvalidRequestException("Problem decoding uri: " + httpAttributes.getUri() + " - "
          + exception.getMessage());
    }

    final int queryIndex = uri.indexOf('?');
    if (queryIndex > 0) {
View Full Code Here

Examples of org.restsql.core.InvalidRequestException

      final String sqlResource, final List<RequestValue> resIds, final List<RequestValue> params,
      final List<List<RequestValue>> childrenParams, final RequestLogger requestLogger)
      throws InvalidRequestException {
    // Verify expectations
    if (sqlResource == null) {
      throw new InvalidRequestException(InvalidRequestException.MESSAGE_SQLRESOURCE_REQUIRED);
    }

    switch (type) {
      case INSERT:
        if (params == null && childrenParams == null) {
          throw new InvalidRequestException(InvalidRequestException.MESSSAGE_INSERT_MISSING_PARAMS);
        }
        break;
      case UPDATE:
        if (params == null && childrenParams == null) {
          throw new InvalidRequestException(InvalidRequestException.MESSSAGE_UPDATE_MISSING_PARAMS);
        }
        break;
      default:
    }
    RequestUtil.checkForInvalidMultipleParameters(params);
View Full Code Here

Examples of org.restsql.core.InvalidRequestException

          case Types.JAVA_OBJECT:
          case Types.LONGVARBINARY:
            if (BinaryObject.isStringBase64((String) value)) {
              value = BinaryObject.fromString((String) value);
            } else {
              throw new InvalidRequestException(
                  InvalidRequestException.MESSAGE_CANNOT_BASE64DECODE,
                  requestValue.getName());
            }

          case Types.DATE:
          case Types.TIME:
          case Types.TIMESTAMP:
          default:
            // do nothing
        }
      } catch (final NumberFormatException e) {
        throw new InvalidRequestException("Could not convert " + requestValue.getName() + " value " + value + " to number");
      }
    }

    requestValue.setValue(value);
  }
View Full Code Here

Examples of org.restsql.core.InvalidRequestException

      }

      // Validate both limit and offset provided
      if (type == Type.SELECT) {
        if (selectLimit != null && selectOffset == null) {
          throw new InvalidRequestException(InvalidRequestException.MESSAGE_OFFSET_REQUIRED);
        } else if (selectOffset != null && selectLimit == null) {
          throw new InvalidRequestException(InvalidRequestException.MESSAGE_LIMIT_REQUIRED);
        } else if (selectLimit != null && selectOffset != null) {
          params.remove(selectLimitRequestValue);
          params.remove(selectOffsetRequestValue);
        }
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.