code
stringlengths
73
34.1k
label
stringclasses
1 value
protected List<IPersonAttributes> searchDirectory(String query, PortletRequest request) { final Map<String, Object> queryAttributes = new HashMap<>(); for (String attr : directoryQueryAttributes) { queryAttributes.put(attr, query); } final List<IPersonAttributes> people; ...
java
protected boolean isMobile(PortletRequest request) { final String themeName = request.getProperty(IPortletRenderer.THEME_NAME_PROPERTY); return "UniversalityMobile".equals(themeName); }
java
protected IPortletEntity unwrapEntity(IPortletEntity portletEntity) { if (portletEntity instanceof TransientPortletEntity) { return ((TransientPortletEntity) portletEntity).getDelegatePortletEntity(); } return portletEntity; }
java
protected IPortletEntity wrapEntity(IPortletEntity portletEntity) { if (portletEntity == null) { return null; } final String persistentLayoutNodeId = portletEntity.getLayoutNodeId(); if (persistentLayoutNodeId.startsWith(TransientUserLayoutManagerWrapper.SUBSCRIBE_PREFIX)) {...
java
public static boolean isValidUrl(String url) { HttpURLConnection huc = null; boolean isValid = false; try { URL u = new URL(url); huc = (HttpURLConnection) u.openConnection(); huc.setRequestMethod("GET"); huc.connect(); int response = h...
java
public static <T> boolean included( T value, Collection<? extends T> includes, Collection<? extends T> excludes) { return (includes.isEmpty() && excludes.isEmpty()) || includes.contains(value) || (includes.isEmpty() && !excludes.contains(value)); }
java
@EventListener public void init(ContextRefreshedEvent event) { idTokenFactory = context.getBean(IdTokenFactory.class); // Make sure we have a guestUsernameSelectors collection & sort it if (guestUsernameSelectors == null) { guestUsernameSelectors = Collections.emptyList(); ...
java
protected boolean handleResourceHeader(String key, String value) { if (ResourceResponse.HTTP_STATUS_CODE.equals(key)) { this.portletResourceOutputHandler.setStatus(Integer.parseInt(value)); return true; } if ("Content-Type".equals(key)) { final ContentType con...
java
@Override public void perform() throws PortalException { // push the change into the PLF if (nodeId.startsWith(Constants.FRAGMENT_ID_USER_PREFIX)) { // remove the parm edit ParameterEditManager.removeParmEditDirective(nodeId, name, person); } // push the fragm...
java
@Override public void add(IPermission perm) throws AuthorizationException { Connection conn = null; int rc = 0; try { conn = RDBMServices.getConnection(); String sQuery = getInsertPermissionSql(); PreparedStatement ps = conn.prepareStatement(sQuery); ...
java
@Override public void delete(IPermission[] perms) throws AuthorizationException { if (perms.length > 0) { try { primDelete(perms); } catch (Exception ex) { log.error("Exception deleting permissions " + Arrays.toString(perms), ex); throw...
java
@Override public void delete(IPermission perm) throws AuthorizationException { Connection conn = null; try { conn = RDBMServices.getConnection(); String sQuery = getDeletePermissionSql(); PreparedStatement ps = conn.prepareStatement(sQuery); try { ...
java
private int getPrincipalType(String principalString) { return Integer.parseInt( principalString.substring(0, principalString.indexOf(PRINCIPAL_SEPARATOR))); }
java
private int primDelete(IPermission perm, PreparedStatement ps) throws Exception { ps.clearParameters(); ps.setString(1, perm.getOwner()); ps.setInt(2, getPrincipalType(perm)); ps.setString(3, getPrincipalKey(perm)); ps.setString(4, perm.getActivity()); ps.setString(5, per...
java
private int primUpdate(IPermission perm, PreparedStatement ps) throws Exception { java.sql.Timestamp ts = null; // UPDATE COLUMNS: ps.clearParameters(); // TYPE: if (perm.getType() == null) { ps.setNull(1, Types.VARCHAR); } else { ps.setString(1,...
java
@Override public IPermission[] select( String owner, String principal, String activity, String target, String type) throws AuthorizationException { Connection conn = null; PreparedStatement stmt = null; ResultSet rs = null; List<IPermission> perms = new ArrayL...
java
@Override public void update(IPermission perm) throws AuthorizationException { Connection conn = null; try { conn = RDBMServices.getConnection(); String sQuery = getUpdatePermissionSql(); if (log.isDebugEnabled()) log.debug("RDBMPermissionImpl.update(): " + sQuer...
java
@Override public PortletEventQueue getPortletEventQueue(HttpServletRequest request) { request = this.portalRequestUtils.getOriginalPortalRequest(request); synchronized (PortalWebUtils.getRequestAttributeMutex(request)) { PortletEventQueue portletEventQueue = (Portlet...
java
protected HttpServletRequest getServletRequestFromExternalContext( ExternalContext externalContext) { Object request = externalContext.getNativeRequest(); if (request instanceof PortletRequest) { return portalRequestUtils.getPortletHttpRequest( (PortletReques...
java
protected IPortletDefinition getChannelDefinition(String subId) throws PortalException { IPortletDefinition chanDef = mChanMap.get(subId); if (null == chanDef) { String fname = getFname(subId); if (log.isDebugEnabled()) log.debug( "Transie...
java
@Override public String getSubscribeId(String fname) throws PortalException { // see if a given subscribe id is already in the map String subId = mFnameMap.get(fname); if (subId == null) { // see if a given subscribe id is already in the layout subId = man.getSubscri...
java
private IUserLayoutChannelDescription getTransientNode(String nodeId) throws PortalException { // get fname from subscribe id final String fname = getFname(nodeId); if (null == fname || fname.equals("")) { return null; } try { // check cache first ...
java
@Override public boolean sendEvent(LrsStatement statement) { if (!isEnabled()) { return false; } ResponseEntity<Object> response = sendRequest( STATEMENTS_REST_ENDPOINT, HttpMethod.POST, null, statement, Object.class); if (response...
java
protected void loadConfig() { if (!isEnabled()) { return; } final String urlProp = format(PROPERTY_FORMAT, id, "url"); LRSUrl = propertyResolver.getProperty(urlProp); actorName = propertyResolver.getProperty(format(PROPERTY_FORMAT, id, "actor-name"), ...
java
protected <T> ResponseEntity<T> sendRequest( String pathFragment, HttpMethod method, List<? extends NameValuePair> getParams, Object postData, Class<T> returnType) { HttpHeaders headers = new HttpHeaders(); headers.add(XAPI_VERSION_HEADER, XAPI...
java
private URI buildRequestURI(String pathFragment, List<? extends NameValuePair> params) { try { String queryString = ""; if (params != null && !params.isEmpty()) { queryString = "?" + URLEncodedUtils.format(params, "UTF-8"); } URI fullURI = new URI...
java
@Override protected void bindAggregationSpecificKeyParameters( TypedQuery<PortletExecutionAggregationImpl> query, Set<PortletExecutionAggregationKey> keys) { query.setParameter(this.portletMappingParameter, extractAggregatePortletMappings(keys)); query.setParameter(this.execu...
java
protected EntityManager getTransactionalEntityManager(EntityManagerFactory emf) throws IllegalStateException { Assert.state(emf != null, "No EntityManagerFactory specified"); return EntityManagerFactoryUtils.getTransactionalEntityManager(emf); }
java
protected EntityManagerFactory getEntityManagerFactory(OpenEntityManager openEntityManager) { final CacheKey key = this.createEntityManagerFactoryKey(openEntityManager); EntityManagerFactory emf = this.entityManagerFactories.get(key); if (emf == null) { emf = this.lookupEntityManager...
java
protected EntityManagerFactory lookupEntityManagerFactory(OpenEntityManager openEntityManager) { String emfBeanName = openEntityManager.name(); String puName = openEntityManager.unitName(); if (StringUtils.hasLength(emfBeanName)) { return this.applicationContext.getBean(emfBeanName, ...
java
@Override public synchronized Object put(Object key, Object value) { ValueWrapper valueWrapper = new ValueWrapper(value); return super.put(key, valueWrapper); }
java
public synchronized Object put(Object key, Object value, long lCacheInterval) { ValueWrapper valueWrapper = new ValueWrapper(value, lCacheInterval); return super.put(key, valueWrapper); }
java
@Override public synchronized Object get(Object key) { ValueWrapper valueWrapper = (ValueWrapper) super.get(key); if (valueWrapper != null) { // Check if value has expired long creationTime = valueWrapper.getCreationTime(); long cacheInterval = valueWrapper.getCac...
java
protected void sweepCache() { for (Iterator keyIterator = keySet().iterator(); keyIterator.hasNext(); ) { Object key = keyIterator.next(); ValueWrapper valueWrapper = (ValueWrapper) super.get(key); long creationTime = valueWrapper.getCreationTime(); long cacheInte...
java
private String getInitParameter(String name, String defaultValue) { String value = getInitParameter(name); if (value != null) { return value; } return defaultValue; }
java
private String getMediaType(String contentType) { if (contentType == null) { return null; } String result = contentType.toLowerCase(Locale.ENGLISH); int firstSemiColonIndex = result.indexOf(';'); if (firstSemiColonIndex > -1) { result = result.substring(0,...
java
public void endParsing() throws SnowflakeSQLException { if (partialEscapedUnicode.position() > 0) { partialEscapedUnicode.flip(); continueParsingInternal(partialEscapedUnicode, true); partialEscapedUnicode.clear(); } if (state != State.ROW_FINISHED) { throw new SnowflakeSQ...
java
public void continueParsing(ByteBuffer in) throws SnowflakeSQLException { if (state == State.UNINITIALIZED) { throw new SnowflakeSQLException(SqlState.INTERNAL_ERROR, ErrorCode.INTERNAL_ERROR.getMessageCode(), "Json parser hasn'...
java
public static void cancel(StmtInput stmtInput) throws SFException, SnowflakeSQLException { HttpPost httpRequest = null; AssertUtil.assertTrue(stmtInput.serverUrl != null, "Missing server url for statement execution"); Asse...
java
static public SFStatementType checkStageManageCommand(String sql) { if (sql == null) { return null; } String trimmedSql = sql.trim(); // skip commenting prefixed with // while (trimmedSql.startsWith("//")) { logger.debug("skipping // comments in: \n{}", trimmedSql); if...
java
public void flush() { if (!enabled) { return; } if (!queue.isEmpty()) { // start a new thread to upload without blocking the current thread Runnable runUpload = new TelemetryUploader(this, exportQueueToString()); uploader.execute(runUpload); } }
java
public String exportQueueToString() { JSONArray logs = new JSONArray(); while (!queue.isEmpty()) { logs.add(queue.poll()); } return SecretDetector.maskAWSSecret(logs.toString()); }
java
public void logHttpRequestTelemetryEvent( String eventName, HttpRequestBase request, int injectSocketTimeout, AtomicBoolean canceling, boolean withoutCookies, boolean includeRetryParameters, boolean includeRequestGuid, CloseableHttpResponse response, final Exception...
java
public final Object getCell(int rowIdx, int colIdx) { if (resultData != null) { return extractCell(resultData, rowIdx, colIdx); } return data.get(colCount * rowIdx + colIdx); }
java
public final void ensureRowsComplete() throws SnowflakeSQLException { // Check that all the rows have been decoded, raise an error if not if (rowCount != currentRow) { throw new SnowflakeSQLException( SqlState.INTERNAL_ERROR, ErrorCode.INTERNAL_ERROR ...
java
static CloseableHttpClient buildHttpClient( boolean insecureMode, File ocspCacheFile, boolean useOcspCacheServer) { // set timeout so that we don't wait forever. // Setup the default configuration for all requests on this client DefaultRequestConfig = RequestConfig.custom() .setC...
java
public static CloseableHttpClient initHttpClient(boolean insecureMode, File ocspCacheFile) { if (httpClient == null) { synchronized (HttpUtil.class) { if (httpClient == null) { httpClient = buildHttpClient( insecureMode, ocspCacheFile, ...
java
public static RequestConfig getDefaultRequestConfigWithSocketTimeout(int soTimeoutMs, boolean withoutCookies) { getHttpClient(); final String cookieSpec = withoutCookies ? IGNORE_COOKIES : DEFAULT; return RequestConfig.copy(DefaultRequestConfig) .setSoc...
java
static String executeRequestWithoutCookies(HttpRequestBase httpRequest, int retryTimeout, int injectSocketTimeout, AtomicBoolean canceling) throws SnowflakeSQLException, IOException ...
java
public static String executeRequest(HttpRequestBase httpRequest, int retryTimeout, int injectSocketTimeout, AtomicBoolean canceling) throws SnowflakeSQLException, IOException { return executeRequest...
java
public static void configureCustomProxyProperties( Map<SFSessionProperty, Object> connectionPropertiesMap) { if (connectionPropertiesMap.containsKey(SFSessionProperty.USE_PROXY)) { useProxy = (boolean) connectionPropertiesMap.get( SFSessionProperty.USE_PROXY); } if (useProxy) ...
java
static private void checkErrorAndThrowExceptionSub( JsonNode rootNode, boolean raiseReauthenticateError) throws SnowflakeSQLException { // no need to throw exception if success if (rootNode.path("success").asBoolean()) { return; } String errorMessage; String sqlState; int er...
java
static void assertTrue(boolean condition, String internalErrorMesg) throws SFException { if (!condition) { throw new SFException(ErrorCode.INTERNAL_ERROR, internalErrorMesg); } }
java
public static MatDesc parse(String matdesc) { if (matdesc == null) { return null; } try { JsonNode jsonNode = mapper.readTree(matdesc); JsonNode queryIdNode = jsonNode.path(QUERY_ID); if (queryIdNode.isMissingNode() || queryIdNode.isNull()) { return null; ...
java
private SFPair<String, String> applySessionContext(String catalog, String schemaPattern) { if (catalog == null && metadataRequestUseConnectionCtx) { catalog = session.getDatabase(); if (schemaPattern == null) { schemaPattern = ses...
java
private short getForeignKeyConstraintProperty( String property_name, String property) { short result = 0; switch (property_name) { case "update": case "delete": switch (property) { case "NO ACTION": result = importedKeyNoAction; break; ...
java
private ResultSet executeAndReturnEmptyResultIfNotFound(Statement statement, String sql, DBMetadataResultSetMetadata metadataType) throws SQLException { ResultSet resultSet; try { resultSet = statement.executeQuery(sql); } catch (Sn...
java
static private ClientAuthnDTO.AuthenticatorType getAuthenticator( LoginInput loginInput) { if (loginInput.getAuthenticator() != null) { if (loginInput.getAuthenticator().equalsIgnoreCase( ClientAuthnDTO.AuthenticatorType.EXTERNALBROWSER.name())) { // SAML 2.0 compliant serv...
java
static public LoginOutput openSession(LoginInput loginInput) throws SFException, SnowflakeSQLException { AssertUtil.assertTrue(loginInput.getServerUrl() != null, "missing server URL for opening session"); AssertUtil.assertTrue(loginInput.getAppId() != null, ...
java
static public LoginOutput issueSession(LoginInput loginInput) throws SFException, SnowflakeSQLException { return tokenRequest(loginInput, TokenRequestType.ISSUE); }
java
static public void closeSession(LoginInput loginInput) throws SFException, SnowflakeSQLException { logger.debug(" public void close() throws SFException"); // assert the following inputs are valid AssertUtil.assertTrue(loginInput.getServerUrl() != null, "missing server URL for...
java
private static String federatedFlowStep3(LoginInput loginInput, String tokenUrl) throws SnowflakeSQLException { String oneTimeToken = ""; try { URL url = new URL(tokenUrl); URI tokenUri = url.toURI(); final HttpPost postRequest = new HttpPost(tokenUri); StringEntity params = ne...
java
private static JsonNode federatedFlowStep1(LoginInput loginInput) throws SnowflakeSQLException { JsonNode dataNode = null; try { URIBuilder fedUriBuilder = new URIBuilder(loginInput.getServerUrl()); fedUriBuilder.setPath(SF_PATH_AUTHENTICATOR_REQUEST); URI fedUrlUri = fedUriBuilder.bui...
java
private static void handleFederatedFlowError(LoginInput loginInput, Exception ex) throws SnowflakeSQLException { if (ex instanceof IOException) { logger.error("IOException when authenticating with " + loginInput.getAuthenticator(), ex); throw new SnowflakeSQLException(ex, Sql...
java
static private String getSamlResponseUsingOkta(LoginInput loginInput) throws SnowflakeSQLException { JsonNode dataNode = federatedFlowStep1(loginInput); String tokenUrl = dataNode.path("tokenUrl").asText(); String ssoUrl = dataNode.path("ssoUrl").asText(); federatedFlowStep2(loginInput, tokenUrl, ss...
java
static boolean isPrefixEqual(String aUrlStr, String bUrlStr) throws MalformedURLException { URL aUrl = new URL(aUrlStr); URL bUrl = new URL(bUrlStr); int aPort = aUrl.getPort(); int bPort = bUrl.getPort(); if (aPort == -1 && "https".equals(aUrl.getProtocol())) { // default port number ...
java
static private String getPostBackUrlFromHTML(String html) { Document doc = Jsoup.parse(html); Elements e1 = doc.getElementsByTag("body"); Elements e2 = e1.get(0).getElementsByTag("form"); String postBackUrl = e2.first().attr("action"); return postBackUrl; }
java
public static Map<String, Object> getCommonParams(JsonNode paramsNode) { Map<String, Object> parameters = new HashMap<>(); for (JsonNode child : paramsNode) { // If there isn't a name then the response from GS must be erroneous. if (!child.hasNonNull("name")) { logger.error("Com...
java
protected ServerSocket getServerSocket() throws SFException { try { return new ServerSocket( 0, // free port 0, // default number of connections InetAddress.getByName("localhost")); } catch (IOException ex) { throw new SFException(ex, ErrorCode.NETWORK_ERR...
java
private String getSSOUrl(int port) throws SFException, SnowflakeSQLException { try { String serverUrl = loginInput.getServerUrl(); String authenticator = loginInput.getAuthenticator(); URIBuilder fedUriBuilder = new URIBuilder(serverUrl); fedUriBuilder.setPath(SessionUtil.SF_PATH_AUTH...
java
private void processSamlToken(String[] rets, Socket socket) throws IOException, SFException { String targetLine = null; String userAgent = null; boolean isPost = false; for (String line : rets) { if (line.length() > PREFIX_GET.length() && line.substring(0, PREFIX_GET.length()).equa...
java
private void returnToBrowser(Socket socket) throws IOException { PrintWriter out = new PrintWriter(socket.getOutputStream(), true); List<String> content = new ArrayList<>(); content.add("HTTP/1.0 200 OK"); content.add("Content-Type: text/html"); String responseText; if (this.origin != null) ...
java
public static TelemetryData buildJobData(String queryId, TelemetryField field, long value) { ObjectNode obj = mapper.createObjectNode(); obj.put(TYPE, field.toString()); obj.put(QUERY_ID, queryId); obj.put(VALUE, value); return new TelemetryData(obj, System.currentTimeMillis()); }
java
@Override public void download(SFSession connection, String command, String localLocation, String destFileName, int parallelism, String remoteStorageLocation, String stageFilePath,...
java
static void resetOCSPResponseCacherServerURL(String ocspCacheServerUrl) { if (ocspCacheServerUrl == null || SF_OCSP_RESPONSE_CACHE_SERVER_RETRY_URL_PATTERN != null) { return; } SF_OCSP_RESPONSE_CACHE_SERVER_URL = ocspCacheServerUrl; if (!SF_OCSP_RESPONSE_CACHE_SERVER_URL.startsWith(DEFAULT_O...
java
private X509TrustManager getTrustManager(String algorithm) { try { TrustManagerFactory factory = TrustManagerFactory.getInstance(algorithm); factory.init((KeyStore) null); X509TrustManager ret = null; for (TrustManager tm : factory.getTrustManagers()) { // Multiple TrustM...
java
void validateRevocationStatus(X509Certificate[] chain, String peerHost) throws CertificateException { final List<Certificate> bcChain = convertToBouncyCastleCertificate(chain); final List<SFPair<Certificate, Certificate>> pairIssuerSubjectList = getPairIssuerSubject(bcChain); if (peerHost.startsW...
java
private void executeRevocationStatusChecks( List<SFPair<Certificate, Certificate>> pairIssuerSubjectList, String peerHost) throws CertificateException { long currentTimeSecond = new Date().getTime() / 1000L; try { for (SFPair<Certificate, Certificate> pairIssuerSubject : pairIssuerSubjectLis...
java
private static String encodeCacheKey(OcspResponseCacheKey ocsp_cache_key) { try { DigestCalculator digest = new SHA1DigestCalculator(); AlgorithmIdentifier algo = digest.getAlgorithmIdentifier(); ASN1OctetString nameHash = ASN1OctetString.getInstance(ocsp_cache_key.nameHash); ASN1Octet...
java
private boolean isCached(List<SFPair<Certificate, Certificate>> pairIssuerSubjectList) { long currentTimeSecond = new Date().getTime() / 1000L; boolean isCached = true; try { for (SFPair<Certificate, Certificate> pairIssuerSubject : pairIssuerSubjectList) { OCSPReq req = createRequ...
java
private static String CertificateIDToString(CertificateID certificateID) { return String.format("CertID. NameHash: %s, KeyHash: %s, Serial Number: %s", byteToHexString(certificateID.getIssuerNameHash()), byteToHexString(certificateID.getIssuerKeyHash()), ...
java
private static SFPair<OcspResponseCacheKey, SFPair<Long, String>> decodeCacheFromJSON(Map.Entry<String, JsonNode> elem) throws IOException { long currentTimeSecond = new Date().getTime() / 1000; byte[] certIdDer = Base64.decodeBase64(elem.getKey()); DLSequence rawCertId = (DLSequence) ASN1ObjectIdentifi...
java
private static ObjectNode encodeCacheToJSON() { try { ObjectNode out = OBJECT_MAPPER.createObjectNode(); for (Map.Entry<OcspResponseCacheKey, SFPair<Long, String>> elem : OCSP_RESPONSE_CACHE.entrySet()) { OcspResponseCacheKey key = elem.getKey(); SFPair<Long, String...
java
private void validateRevocationStatusMain( SFPair<Certificate, Certificate> pairIssuerSubject, String ocspRespB64) throws CertificateException { try { OCSPResp ocspResp = b64ToOCSPResp(ocspRespB64); Date currentTime = new Date(); BasicOCSPResp basicOcspResp = (BasicOCSPResp) (ocs...
java
private void validateBasicOcspResponse( Date currentTime, BasicOCSPResp basicOcspResp) throws CertificateEncodingException { for (SingleResp singleResps : basicOcspResp.getResponses()) { Date thisUpdate = singleResps.getThisUpdate(); Date nextUpdate = singleResps.getNextUpdate(); LOG...
java
private static void verifySignature( X509CertificateHolder cert, byte[] sig, byte[] data, AlgorithmIdentifier idf) throws CertificateException { try { String algorithm = SIGNATURE_OID_TO_STRING.get(idf.getAlgorithm()); if (algorithm == null) { throw new NoSuchAlgorithmExc...
java
private static String byteToHexString(byte[] bytes) { final char[] hexArray = "0123456789ABCDEF".toCharArray(); char[] hexChars = new char[bytes.length * 2]; for (int j = 0; j < bytes.length; j++) { int v = bytes[j] & 0xFF; hexChars[j * 2] = hexArray[v >>> 4]; hexChars[j * 2 + 1] = h...
java
private OCSPReq createRequest( SFPair<Certificate, Certificate> pairIssuerSubject) { Certificate issuer = pairIssuerSubject.left; Certificate subject = pairIssuerSubject.right; OCSPReqBuilder gen = new OCSPReqBuilder(); try { DigestCalculator digest = new SHA1DigestCalculator(); ...
java
private List<Certificate> convertToBouncyCastleCertificate( X509Certificate[] chain) { final List<Certificate> bcChain = new ArrayList<>(); for (X509Certificate cert : chain) { try { bcChain.add(Certificate.getInstance(cert.getEncoded())); } catch (CertificateEncoding...
java
private List<SFPair<Certificate, Certificate>> getPairIssuerSubject( List<Certificate> bcChain) { List<SFPair<Certificate, Certificate>> pairIssuerSubject = new ArrayList<>(); for (int i = 0, len = bcChain.size(); i < len; ++i) { Certificate bcCert = bcChain.get(i); if (bcCert.getIssuer(...
java
private Set<String> getOcspUrls(Certificate bcCert) { TBSCertificate bcTbsCert = bcCert.getTBSCertificate(); Extensions bcExts = bcTbsCert.getExtensions(); if (bcExts == null) { throw new RuntimeException("Failed to get Tbs Certificate."); } Set<String> ocsp = new HashSet<>(); for (...
java
private static boolean isValidityRange(Date currentTime, Date thisUpdate, Date nextUpdate) { long tolerableValidity = calculateTolerableVadility(thisUpdate, nextUpdate); return thisUpdate.getTime() - MAX_CLOCK_SKEW_IN_MILLISECONDS <= currentTime.getTime() && currentTime.getTime() <= nextUpdate.getT...
java
private void processKeyUpdateDirective(String issuer, String ssd) { try { /** * Get unverified part of the JWT to extract issuer. * */ //PlainJWT jwt_unverified = PlainJWT.parse(ssd); SignedJWT jwt_signed = SignedJWT.parse(ssd); String jwt_issuer = (String) jwt_sig...
java
private String ocspResponseToB64(OCSPResp ocspResp) { if (ocspResp == null) { return null; } try { return Base64.encodeBase64String(ocspResp.getEncoded()); } catch (Throwable ex) { LOGGER.debug("Could not convert OCSP Response to Base64"); return null; } }
java
private void scheduleHeartbeat() { // elapsed time in seconds since the last heartbeat long elapsedSecsSinceLastHeartBeat = System.currentTimeMillis() / 1000 - lastHeartbeatStartTimeInSecs; /* * The initial delay for the new scheduling is 0 if the elapsed * time is more than the heartbe...
java
public SnowflakeStorageClient createClient(StageInfo stage, int parallel, RemoteStoreFileEncryptionMaterial encMat) throws SnowflakeSQLException { logger.debug("createClient client type={}", stage.getStageType().name()); ...
java
private SnowflakeS3Client createS3Client(Map stageCredentials, int parallel, RemoteStoreFileEncryptionMaterial encMat, String stageRegion) throws SnowflakeSQLException { final int S3_...
java
public StorageObjectMetadata createStorageMetadataObj(StageInfo.StageType stageType) { switch (stageType) { case S3: return new S3ObjectMetadata(); case AZURE: return new AzureObjectMetadata(); default: // An unsupported remote storage client type was specified ...
java
private SnowflakeAzureClient createAzureClient(StageInfo stage, RemoteStoreFileEncryptionMaterial encMat) throws SnowflakeSQLException { logger.debug("createAzureClient encryption={}", (encMat == null ? "no" : "yes")); //TODO: implement support for encryptio...
java
public synchronized static BindUploader newInstance(SFSession session, String stageDir) throws BindException { try { Path bindDir = Files.createTempDirectory(PREFIX); return new BindUploader(session, stageDir, bindDir); } catch (IOException ex) { throw new BindException( ...
java