Skip to content

Instantly share code, notes, and snippets.

View goeh's full-sized avatar

Göran Ehrsson goeh

View GitHub Profile
@goeh
goeh / set-keycloak-client-secret.groovy
Created November 29, 2019 12:00
Inject client secrets from a local file into a Keycloak Realm Export (JSON) file
import groovy.json.JsonSlurper
import groovy.json.JsonOutput
def jsonSlurper = new JsonSlurper()
def secrets = jsonSlurper.parse(new File(args[1] ?: "secrets.json")).clients.inject([:]) { map, c -> map[c.client] = c.secret; map }
def realm = jsonSlurper.parse(new File(args[0]))
for(client in realm.clients) {
if(secrets[client.clientId]) {
@goeh
goeh / vuetify-horizontal-timeline.md
Last active September 17, 2019 23:10
Requirements for a new Vuetify Horizontal Timeline component

Horizontal Timeline Component - requirements

Must have

User Interface

Vuetify Component

  • Follow Vuetify / Material Design look and feel
  • Compatible with Vuetify, light/dark theme.
  • Follow Vuetify conventions, naming, props, events, etc.
@goeh
goeh / MinIO.groovy
Created July 12, 2019 08:36
Groovy script to test MinIO
@Grab('io.minio:minio:6.0.8')
import io.minio.MinioClient
def serviceUrl = "https://minioserver:9000"
def accessKey = "*****"
def secretKey = "*****"
def bucketName = "groovy-test"
def client = new MinioClient(serviceUrl, accessKey, secretKey)
@goeh
goeh / JwtTokenServicesConfiguration.java
Last active May 14, 2018 07:47
Trying to create a JWT token enhancer that work with Ribbon/Eureka service names instead of URLs, but I could not get it to work. Service not found.
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.security.oauth2.resource.JwtAccessTokenConverterConfigurer;
import org.springframework.boot.autoconfigure.security.oauth2.resource.ResourceServerProperties;
import org.springframework.boot.autoconfigure.security.oauth2.resource.ResourceServerTokenServicesConfiguration;
import org.springframework.cloud.client.ServiceInstance;
import org.springframework.cloud.client.loadbalancer.LoadBalancerClient;
@goeh
goeh / StringTrimModule.java
Created November 22, 2015 17:52
Trim strings in JSON paylod
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.deser.std.StdScalarDeserializer;
import com.fasterxml.jackson.databind.module.SimpleModule;
import org.springframework.stereotype.Component;
import java.io.IOException;
@Component
@goeh
goeh / ExtendedEvents.groovy
Created May 25, 2015 12:10
Allow you to send an event to multiple subscribers, then collect multiple responses
import groovy.transform.CompileStatic
import org.springframework.beans.factory.annotation.Autowired
import reactor.Environment
import reactor.bus.Event
import reactor.bus.EventBus
import reactor.bus.registry.Registration
import reactor.bus.registry.Registry
import reactor.bus.selector.Selector
import reactor.bus.selector.Selectors
import reactor.rx.Promise