Skip to content

Instantly share code, notes, and snippets.

View arleighdickerson's full-sized avatar
👉
Let all naysayers know

Arleigh Dickerson arleighdickerson

👉
Let all naysayers know
View GitHub Profile
package com.teletapper.actuator;
import com.teletapper.util.SecurityUtils;
import lombok.Data;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import lombok.val;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.actuate.endpoint.annotation.ReadOperation;
import org.springframework.boot.actuate.endpoint.jmx.annotation.JmxEndpoint;
@arleighdickerson
arleighdickerson / inversify-provider.tsx
Created December 12, 2024 17:52
inversify-provider.tsx
import { AsyncContainerModule, Container as ContainerImpl, ContainerModule } from 'inversify';
import { Provider as IocProvider } from 'inversify-react';
import _ from 'lodash';
import { PropsWithChildren, useEffect, useState } from 'react';
const context = require.context('src', true, /\.config\.ts$|\.config\.tsx$|\.saga\.ts|\.events\.ts$/, 'lazy-once');
const keys = context.keys();
const getApplicationContext = _.once(async () => {
const container = new ContainerImpl({ defaultScope: 'Request' });
import io.undertow.connector.ByteBufferPool;
import io.undertow.server.DefaultByteBufferPool;
import io.undertow.websockets.jsr.WebSocketDeploymentInfo;
import org.springframework.boot.web.embedded.undertow.UndertowServletWebServerFactory;
import org.springframework.boot.web.server.WebServerFactoryCustomizer;
import org.springframework.context.annotation.Configuration;
@Configuration
class UndertowConfig implements WebServerFactoryCustomizer<UndertowServletWebServerFactory> {
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import org.springframework.data.redis.core.RedisKeyValueAdapter;
import org.springframework.data.redis.repository.configuration.EnableRedisRepositories;
import org.springframework.session.data.redis.config.ConfigureRedisAction;
// https://dzone.com/articles/build-a-chat-application-using-spring-boot-websock
// https://engineering.salesforce.com/lessons-learned-using-spring-data-redis-f3121f89bff9
// https://help.heroku.com/5BP0E8RC/how-to-enable-notify-keyspace-events-on-redis
import io.arleigh.gantry.cache.PrefixedKeyGenerator;
import io.arleigh.gantry.properties.AppRedisProperties;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import lombok.val;
import org.redisson.api.RedissonClient;
import org.redisson.jcache.configuration.RedissonConfiguration;
import org.redisson.spring.cache.RedissonSpringCacheManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.cache.JCacheManagerCustomizer;
import lombok.NonNull;
import lombok.SneakyThrows;
import org.apache.commons.codec.binary.Base32;
import org.springframework.lang.Nullable;
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import java.util.Arrays;
import java.util.Locale;
import java.util.regex.Pattern;
import org.springframework.lang.Nullable;
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.time.Duration;
import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.Random;
import java.util.UUID;
import io.arleigh.gantry.util.UuidGenerator;
import lombok.RequiredArgsConstructor;
import org.slf4j.MDC;
import org.springframework.context.annotation.Profile;
import org.springframework.lang.NonNull;
import org.springframework.stereotype.Component;
import org.springframework.web.filter.OncePerRequestFilter;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import io.arleigh.gantry.util.SecurityUtils;
import lombok.extern.slf4j.Slf4j;
import lombok.val;
import org.slf4j.MDC;
import org.springframework.boot.actuate.audit.listener.AuditApplicationEvent;
import org.springframework.context.event.EventListener;
import org.springframework.security.access.event.AbstractAuthorizationEvent;
import org.springframework.security.access.event.AuthorizationFailureEvent;
import org.springframework.stereotype.Component;
import org.springframework.util.ReflectionUtils;
// noinspection RegExpSingleCharAlternation,RegExpUnnecessaryNonCapturingGroup
const isoEightSixZeroOne = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*))(?:Z|(\+|-)([\d|:]*))?$/;
export namespace jsonUtil {
export function isJsonPatch(obj: any): obj is unknown {
return false;
}
export function jsonReviver(key: string, value: any) {