@@ -0,0 +1,2919 @@
+/*%0A * Copyright (c) 2018, WSO2 Inc. (http://www.wso2.com). All Rights Reserved.%0A *%0A * This software is the property of WSO2 Inc. and its suppliers, if any.%0A * Dissemination of any information or reproduction of any material contained%0A * herein is strictly forbidden, unless permitted by WSO2 in accordance with%0A * the WSO2 Commercial License available at http://wso2.com/licenses. For specific%0A * language governing the permissions and limitations under this license,%0A * please see the license as well as any agreement you%E2%80%99ve entered into with%0A * WSO2 governing the purchase of this software and any associated services.%0A */%0A%0Apackage org.wso2.carbon.identity.sso.saml.dao;%0A%0Aimport org.apache.commons.logging.Log;%0Aimport org.apache.commons.logging.LogFactory;%0Aimport org.opensaml.saml2.core.Assertion;%0Aimport org.wso2.carbon.identity.base.IdentityException;%0Aimport org.wso2.carbon.identity.core.persistence.JDBCPersistenceManager;%0Aimport org.wso2.carbon.identity.sso.saml.util.SAMLSSOUtil;%0A%0Aimport java.sql.Connection;%0Aimport java.sql.PreparedStatement;%0Aimport java.sql.SQLException;%0A%0A/**%0A * DAO class used to manipulate SAML artifacts data in the database.%0A */%0Apublic class SAMLArtifactDAO %7B%0A%0A    private final static Log log = LogFactory.getLog(SAMLArtifactDAO.class);%0A%0A    private final static String ARTIFACT_STORE_SQL = %22INSERT INTO IDN_SAML2_ARTIFACT_STORE(TYPE_CODE,%22 +%0A            %22ENDPOINT_INDEX, SOURCE_ID, MESSAGE_HANDLER, SAML2_ASSERTION, STATUS) VALUES (?, ?, ?, ?, ?, ?)%22;%0A%0A    /**%0A     * Store SAML artifact in the database.%0A     *%0A     * @param typeCode       Type code of the artifact.%0A     * @param endpointIndex  Endpoint index of the artifact.%0A     * @param sourceID       Source ID  of the artifact.%0A     * @param messageHandler Message Handler  of the artifact.%0A     * @param samlAssertion  Generated SAML assertion.%0A     * @param status         Status of the artifact. %7BINITIATED, RETRIEVED%7D%0A     * @throws IdentityException%0A     */%0A    public void storeArtifact(byte%5B%5D typeCode, byte%5B%5D endpointIndex, byte%5B%5D sourceID, byte%5B%5D messageHandler,%0A                              Assertion samlAssertion, String status) throws IdentityException %7B%0A%0A        try (Connection connection = JDBCPersistenceManager.getInstance().getDBConnection();%0A             PreparedStatement preparedStatement = connection.prepareStatement(ARTIFACT_STORE_SQL)) %7B%0A%0A            preparedStatement.setBytes(1, typeCode);%0A            preparedStatement.setBytes(2, endpointIndex);%0A            preparedStatement.setBytes(3, sourceID);%0A            preparedStatement.setBytes(4, messageHandler);%0A            preparedStatement.setString(5, SAMLSSOUtil.marshall(samlAssertion));%0A            preparedStatement.setString(6, status);%0A%0A            preparedStatement.executeUpdate();%0A            connection.commit();%0A%0A        %7D catch (SQLException e) %7B%0A            log.error(%22Error while storing SAML artifact data: %22, e);%0A        %7D%0A    %7D%0A%7D%0A

Add DAO class for SAML artifacts