コード例 #1
0
 /**
  * Supprime le distances/blason de la base.
  *
  * @throws SQLException
  */
 @Override
 public void delete() throws SqlPersistanceException {
   helper.delete(
       this,
       Collections.singletonMap(
           "NUMREGLEMENT", (Object) criteriaSet.getReglement().getNumReglement())); // $NON-NLS-1$
 }
コード例 #2
0
 /* (non-Javadoc)
  * @see java.lang.Object#hashCode()
  */
 @Override
 public int hashCode() {
   final int prime = 31;
   int result = 1;
   result = prime * result + ((criteriaSet == null) ? 0 : criteriaSet.hashCode());
   result = prime * result + Arrays.hashCode(distances);
   result = prime * result + ((targetFace == null) ? 0 : targetFace.hashCode());
   return result;
 }
コード例 #3
0
  /**
   * Sauvegarde le couple distances/blasons en base.
   *
   * @see org.ajdeveloppement.commons.sql.SqlPersistance#save()
   * @throws SqlPersistanceException
   */
  @SuppressWarnings("nls")
  @Override
  public void save() throws SqlPersistanceException {
    criteriaSet.save();

    Map<String, Object> fk = new HashMap<String, Object>();
    fk.put("NUMREGLEMENT", criteriaSet.getReglement().getNumReglement()); // $NON-NLS-1$
    fk.put("NUMBLASON", targetFace.getNumblason());
    fk.put("NUMCRITERIASET", criteriaSet.getNumCriteriaSet());
    helper.save(this, fk);

    try {
      Statement stmt = ApplicationCore.dbConnection.createStatement();
      try {
        stmt.executeUpdate(
            "delete from DISTANCES where NUMDISTANCESBLASONS="
                + numdistancesblason
                + " and NUMREGLEMENT="
                + criteriaSet.getReglement().getNumReglement());
        int i = 1;
        for (int distance : distances) {
          stmt.executeUpdate(
              "insert into DISTANCES (NUMDISTANCES, NUMDISTANCESBLASONS, NUMREGLEMENT, DISTANCE) "
                  + //$NON-NLS-1$
                  "VALUES ("
                  + (i++)
                  + ", "
                  + numdistancesblason
                  + ", "
                  + criteriaSet.getReglement().getNumReglement()
                  + ", "
                  + distance
                  + ")");
        }
      } finally {
        stmt.close();
      }
    } catch (SQLException e) {
      throw new SqlPersistanceException(e);
    }
  }
コード例 #4
0
  @Override
  public void onAuthenticationFailure(
      HttpServletRequest request,
      HttpServletResponse response,
      AuthenticationException authenticationException)
      throws IOException, ServletException {
    logger.debug(
        "commencing RealAuthenticationFailureHandler because of {}",
        authenticationException.getClass());

    AuthnRequestInfo authnRequestInfo =
        (AuthnRequestInfo) request.getSession().getAttribute(AuthnRequestInfo.class.getName());

    if (authnRequestInfo == null) {
      logger.warn(
          "Could not find AuthnRequestInfo on the request.  Delegating to nonSSOAuthnFailureHandler.");
      nonSSOAuthnFailureHandler.onAuthenticationFailure(request, response, authenticationException);
      return;
    }

    logger.debug("AuthnRequestInfo is {}", authnRequestInfo);

    request
        .getSession()
        .setAttribute(WebAttributes.AUTHENTICATION_EXCEPTION, authenticationException);

    CriteriaSet criteriaSet = new CriteriaSet();
    criteriaSet.add(new EntityIDCriteria(idpConfiguration.getEntityID()));
    criteriaSet.add(new UsageCriteria(UsageType.SIGNING));

    Credential signingCredential = null;
    try {
      signingCredential = credentialResolver.resolveSingle(criteriaSet);
    } catch (org.opensaml.xml.security.SecurityException e) {
      logger.warn("Unable to resolve signing credential for entityId", e);
      return;
    }
    Validate.notNull(signingCredential);

    AuthnResponseGenerator authnResponseGenerator =
        new AuthnResponseGenerator(
            signingCredential,
            idpConfiguration.getEntityID(),
            timeService,
            idService,
            idpConfiguration);
    EndpointGenerator endpointGenerator = new EndpointGenerator();

    Response authResponse =
        authnResponseGenerator.generateAuthnResponseFailure(
            authnRequestInfo.getAssertionConsumerURL(),
            authnRequestInfo.getAuthnRequestID(),
            authenticationException);
    Endpoint endpoint =
        endpointGenerator.generateEndpoint(
            AssertionConsumerService.DEFAULT_ELEMENT_NAME,
            authnRequestInfo.getAssertionConsumerURL(),
            null);

    request.getSession().removeAttribute(AuthnRequestInfo.class.getName());

    String relayState = request.getParameter("RelayState");
    try {
      bindingAdapter.sendSAMLMessage(
          authResponse, endpoint, response, relayState, signingCredential);
    } catch (MessageEncodingException mee) {
      logger.error("Exception encoding SAML message", mee);
      response.sendError(HttpServletResponse.SC_SERVICE_UNAVAILABLE);
    }
  }
コード例 #5
0
 @SuppressWarnings("unused")
 protected void afterUnmarshal(Unmarshaller unmarshaller, Object parent) {
   if (parent instanceof Reglement) criteriaSet.setReglement((Reglement) parent);
 }