Skip to content

Instantly share code, notes, and snippets.

@abn
abn / keycloak-fetch-token-postman-pre-request.js
Created October 12, 2017 13:02
A postman pre-request script to fetch a valid token from Red Hat SSO (Keycloak) and set it to a template variable to use in request headers.
// modify these configurations to work with your environment
var server = "https://sso.example.com";
var realm = "realm";
var resource = "client";
var username = "username";
var password = "url encoded password";
var url = `${server}/auth/realms/${realm}/protocol/openid-connect/token`;
var data = `grant_type=password&client_id=${resource}&username=${username}&password=${password}`;

OpenShift Developer Cluster on OSX

This document details how to bring up an OpenShift local cluster on Mac OSX. We also detail how to do the same under a proxied environment.

System Requirements

  1. Docker for Mac (stable). Note that this will also work with Docker Toolbox for Mac, however this is untested and could have issues with networking.
  2. Homebrew package manager for macOS. If you are installing from behind a proxy, use the script available at this gist.

Install OpenShift CLI

The openshift-cli can be installed via homebrew. This package provides us with the oc binary.

@virgium03
virgium03 / SecurityConfig.java
Last active December 16, 2017 18:26
Spring Security Java configuration for Pre-authenticated scenario
import org.springframework.boot.context.embedded.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.access.AccessDecisionVoter;
import org.springframework.security.access.vote.AffirmativeBased;
import org.springframework.security.access.vote.RoleVoter;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.authentication.AuthenticationProvider;
import org.springframework.security.authentication.ProviderManager;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;