/** * @see SecurityTokenRegistry#getToken(String) */ public Object getToken(String tokenID) { try { return unmarshalToken(getLOB(tokenID)); } catch (IOException e) { throw logger.runtimeException("getToken", e); } }
/** * @see SecurityTokenRegistry#getToken(String) */ public Object getToken(String tokenID) { try { return unmarshalToken(getLOB(tokenID)); } catch (IOException e) { throw logger.runtimeException("getToken", e); } }
/** * @see SecurityTokenRegistry#getToken(String) */ @Override public Object getToken(String tokenID) { try { return unmarshalToken(getLOB(tokenID)); } catch (IOException e) { throw logger.runtimeException("getToken", e); } }
/** * @see SecurityTokenRegistry#getToken(String) */ @Override public Object getToken(String tokenID) { try { return unmarshalToken(getLOB(tokenID)); } catch (IOException e) { throw logger.runtimeException("getToken", e); } }
/** * @see RevocationRegistry#revokeToken(String, String) */ public void revokeToken(String tokenType, String tokenID) { if (dataSource == null) { throw logger.datasourceIsNull(); } Connection conn = null; PreparedStatement preparedStatement = null; try { conn = dataSource.getConnection(); Date tokenCreationDate = Calendar.getInstance().getTime(); preparedStatement = conn.prepareStatement(INSERT_TABLE_SQL); preparedStatement.setString(1, tokenID); preparedStatement.setString(2, tokenType); preparedStatement .setTimestamp(3, new Timestamp(tokenCreationDate.getTime()), Calendar.getInstance(TimeZone.getTimeZone("UTC"))); preparedStatement.executeUpdate(); } catch (SQLException e) { throw logger.runtimeException("revokeToken", e); } finally { safeClose(preparedStatement); safeClose(conn); } } }
/** * @see RevocationRegistry#revokeToken(String, String) */ public void revokeToken(String tokenType, String tokenID) { if (dataSource == null) { throw logger.datasourceIsNull(); } String insertTableSQL = "INSERT INTO REVOCATION_REGISTRY" + "(TOKEN_ID, TOKEN_TYPE, CREATED_DATE) VALUES" + "(?,?,?)"; Connection conn = null; PreparedStatement preparedStatement = null; try { conn = dataSource.getConnection(); Date tokenCreationDate = Calendar.getInstance().getTime(); preparedStatement = conn.prepareStatement(insertTableSQL); preparedStatement.setString(1, tokenID); preparedStatement.setString(2, tokenType); preparedStatement.setTimestamp(3, new Timestamp(tokenCreationDate.getTime())); preparedStatement.executeUpdate(); } catch (SQLException e) { throw logger.runtimeException("revokeToken", e); } finally { safeClose(preparedStatement); safeClose(conn); } } }
/** * @see RevocationRegistry#revokeToken(String, String) */ public void revokeToken(String tokenType, String tokenID) { if (dataSource == null) { throw logger.datasourceIsNull(); } Connection conn = null; PreparedStatement preparedStatement = null; try { conn = dataSource.getConnection(); Date tokenCreationDate = Calendar.getInstance().getTime(); preparedStatement = conn.prepareStatement(INSERT_TABLE_SQL); preparedStatement.setString(1, tokenID); preparedStatement.setString(2, tokenType); preparedStatement .setTimestamp(3, new Timestamp(tokenCreationDate.getTime()), Calendar.getInstance(TimeZone.getTimeZone("UTC"))); preparedStatement.executeUpdate(); } catch (SQLException e) { throw logger.runtimeException("revokeToken", e); } finally { safeClose(preparedStatement); safeClose(conn); } } }
/** * @see RevocationRegistry#revokeToken(String, String) */ public void revokeToken(String tokenType, String tokenID) { if (dataSource == null) { throw logger.datasourceIsNull(); } String insertTableSQL = "INSERT INTO REVOCATION_REGISTRY" + "(TOKEN_ID, TOKEN_TYPE, CREATED_DATE) VALUES" + "(?,?,?)"; Connection conn = null; PreparedStatement preparedStatement = null; try { conn = dataSource.getConnection(); Date tokenCreationDate = Calendar.getInstance().getTime(); preparedStatement = conn.prepareStatement(insertTableSQL); preparedStatement.setString(1, tokenID); preparedStatement.setString(2, tokenType); preparedStatement.setTimestamp(3, new Timestamp(tokenCreationDate.getTime())); preparedStatement.executeUpdate(); } catch (SQLException e) { throw logger.runtimeException("revokeToken", e); } finally { safeClose(preparedStatement); safeClose(conn); } } }
/** * Set the {@link SAMLConfigurationProvider} fqn * * @param configProviderFQN fqn of a {@link SAMLConfigurationProvider} */ public void setConfigProvider(String configProviderFQN) { if (configProviderFQN == null) { throw logger.nullValueError("cp"); } Class<?> clazz = SecurityActions.loadClass(getClass(), configProviderFQN); if (clazz == null) { throw logger.nullValueError("clazz"); } try { configProvider = (SAMLConfigurationProvider) clazz.newInstance(); } catch (Exception e) { throw logger.runtimeException(ErrorCodes.CANNOT_CREATE_INSTANCE + configProviderFQN + ":" + e.getMessage(), e); } }
/** * Set the {@link SAMLConfigurationProvider} fqn * * @param configProviderFQN fqn of a {@link SAMLConfigurationProvider} */ public void setConfigProvider(String configProviderFQN) { if (configProviderFQN == null) { throw logger.nullValueError("cp"); } Class<?> clazz = SecurityActions.loadClass(getClass(), configProviderFQN); if (clazz == null) { throw logger.nullValueError("clazz"); } try { configProvider = (SAMLConfigurationProvider) clazz.newInstance(); } catch (Exception e) { throw logger.runtimeException(ErrorCodes.CANNOT_CREATE_INSTANCE + configProviderFQN + ":" + e.getMessage(), e); } }
/** * Set the {@link SAMLConfigurationProvider} fqn * * @param configProviderFQN fqn of a {@link SAMLConfigurationProvider} */ public void setConfigProvider(String configProviderFQN) { if (configProviderFQN == null) { throw logger.nullValueError("cp"); } Class<?> clazz = SecurityActions.loadClass(getClass(), configProviderFQN); if (clazz == null) { throw logger.nullValueError("clazz"); } try { configProvider = (SAMLConfigurationProvider) clazz.newInstance(); } catch (Exception e) { throw logger.runtimeException(ErrorCodes.CANNOT_CREATE_INSTANCE + configProviderFQN + ":" + e.getMessage(), e); } }
/** * @see RevocationRegistry#isRevoked(String, String) */ public boolean isRevoked(String tokenType, String tokenID) { if (dataSource == null) { throw logger.datasourceIsNull(); } String existsTableSQL = "SELECT COUNT(*) FROM REVOCATION_REGISTRY WHERE TOKEN_ID =? AND TOKEN_TYPE = ?"; Connection conn = null; PreparedStatement preparedStatement = null; ResultSet resultSet = null; try { conn = dataSource.getConnection(); Date tokenCreationDate = Calendar.getInstance().getTime(); preparedStatement = conn.prepareStatement(existsTableSQL); preparedStatement.setString(1, tokenID); preparedStatement.setString(2, tokenType); resultSet = preparedStatement.executeQuery(); return resultSet.getInt(1) > 0; } catch (SQLException e) { throw logger.runtimeException("revokeToken", e); } finally { safeClose(resultSet); safeClose(preparedStatement); safeClose(conn); } }
/** * @see RevocationRegistry#isRevoked(String, String) */ public boolean isRevoked(String tokenType, String tokenID) { if (dataSource == null) { throw logger.datasourceIsNull(); } Connection conn = null; PreparedStatement preparedStatement = null; ResultSet resultSet = null; try { conn = dataSource.getConnection(); preparedStatement = conn.prepareStatement(EXISTS_TABLE_SQL); preparedStatement.setString(1, tokenID); preparedStatement.setString(2, tokenType); resultSet = preparedStatement.executeQuery(); return resultSet.getInt(1) > 0; } catch (SQLException e) { throw logger.runtimeException("revokeToken", e); } finally { safeClose(resultSet); safeClose(preparedStatement); safeClose(conn); } }
/** * @see RevocationRegistry#isRevoked(String, String) */ public boolean isRevoked(String tokenType, String tokenID) { if (dataSource == null) { throw logger.datasourceIsNull(); } String existsTableSQL = "SELECT COUNT(*) FROM REVOCATION_REGISTRY WHERE TOKEN_ID =? AND TOKEN_TYPE = ?"; Connection conn = null; PreparedStatement preparedStatement = null; ResultSet resultSet = null; try { conn = dataSource.getConnection(); Date tokenCreationDate = Calendar.getInstance().getTime(); preparedStatement = conn.prepareStatement(existsTableSQL); preparedStatement.setString(1, tokenID); preparedStatement.setString(2, tokenType); resultSet = preparedStatement.executeQuery(); return resultSet.getInt(1) > 0; } catch (SQLException e) { throw logger.runtimeException("revokeToken", e); } finally { safeClose(resultSet); safeClose(preparedStatement); safeClose(conn); } }
/** * @see RevocationRegistry#isRevoked(String, String) */ public boolean isRevoked(String tokenType, String tokenID) { if (dataSource == null) { throw logger.datasourceIsNull(); } Connection conn = null; PreparedStatement preparedStatement = null; ResultSet resultSet = null; try { conn = dataSource.getConnection(); preparedStatement = conn.prepareStatement(EXISTS_TABLE_SQL); preparedStatement.setString(1, tokenID); preparedStatement.setString(2, tokenType); resultSet = preparedStatement.executeQuery(); return resultSet.getInt(1) > 0; } catch (SQLException e) { throw logger.runtimeException("revokeToken", e); } finally { safeClose(resultSet); safeClose(preparedStatement); safeClose(conn); } }