Skip to content

Instantly share code, notes, and snippets.

@dacrome
dacrome / update-gradle-wrapper.sh
Last active July 4, 2017 14:07
update gradle wrapper version
export NEW_GRADLE_VERSION=4.0
# Yes 2 times to update all files
./gradlew wrapper --gradle-version $NEW_GRADLE_VERSION --distribution-type all
./gradlew wrapper --gradle-version $NEW_GRADLE_VERSION --distribution-type all
git commit -am "Update Gradle to version $NEW_GRADLE_VERSION"
git push HEAD:refs/heads/update-gradle-to-$NEW_GRADLE_VERSION
@dacrome
dacrome / OsiamAuthenticationProvider.java
Last active November 10, 2016 15:47
Use OSIAM with Spring Security
import org.osiam.client.OsiamConnector;
import org.osiam.client.exception.OsiamRequestException;
import org.osiam.client.oauth.AccessToken;
import org.osiam.client.oauth.Scope;
import org.osiam.resources.scim.User;
import org.springframework.security.authentication.AuthenticationProvider;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.core.authority.SimpleGrantedAuthority;

Keybase proof

I hereby claim:

  • I am dacrome on github.
  • I am dacrome (https://keybase.io/dacrome) on keybase.
  • I have a public key whose fingerprint is 7A96 0E97 4464 5452 2B57 531D 0924 59FD 5F0D 73B2

To claim this, I am signing this object:

@dacrome
dacrome / osiam.properties
Created November 3, 2015 22:23
OSIAM vagrant vm properties
# Home URL (needed for self reference)
org.osiam.home=http://localhost:8080/osiam
#
# Database configuration (PostgreSQL)
#
org.osiam.db.vendor=postgresql
org.osiam.db.driver=org.postgresql.Driver
org.osiam.db.url=jdbc:postgresql://localhost:5432/ong
org.osiam.db.username=ong
@dacrome
dacrome / After
Created October 11, 2015 18:51
ObjectMapper with Jersey Client
public Client updateClient(String updateClientId, Client client, AccessToken accessToken) {
Client updatedClient = null;
try {
updatedClient = targetEndpoint.path(CLIENT_ENDPOINT).path(updateClientId)
.request(MediaType.APPLICATION_JSON)
.property(HttpAuthenticationFeature.HTTP_AUTHENTICATION_USERNAME, clientId)
.property(HttpAuthenticationFeature.HTTP_AUTHENTICATION_PASSWORD, clientSecret)
.property(ClientProperties.CONNECT_TIMEOUT, connectionTimeout)
.property(ClientProperties.READ_TIMEOUT, readTimeout)
@dacrome
dacrome / spring ldap config
Created August 20, 2015 20:57
spring ldap config
auth
.authenticationProvider(provider)
.ldapAuthentication()
.userDnPatterns(dnPatterns)
.groupSearchBase(groupSearchBase)
.contextSource().url(url);
@dacrome
dacrome / haproxy.cfg
Created August 4, 2015 08:27
HAProxy Config
global
maxconn 2000
user haproxy
group haproxy
listen tcp-in *:80
timeout connect 3600s
timeout client 60m
timeout server 60m
mode tcp
@dacrome
dacrome / gist:0f9226cd859758c877a3
Created May 25, 2015 22:07
Disable Thymeleaf Template Location Check
@Autowired
public void disableTemplateLocationCheck(ThymeleafProperties properties) {
properties.setCheckTemplateLocation(false);
}
@dacrome
dacrome / recovery.conf
Created March 29, 2015 01:38
postgres recovery.conf sample
# -------------------------------
# PostgreSQL recovery config file
# -------------------------------
#
# Edit this file to provide the parameters that PostgreSQL needs to
# perform an archive recovery of a database, or to act as a replication
# standby.
#
# If "recovery.conf" is present in the PostgreSQL data directory, it is
# read on postmaster startup. After successful recovery, it is renamed
@dacrome
dacrome / gist:31edbb3b9e894258e937
Created October 15, 2014 05:21
configuration of available fields and which are required for the self-administration registration html form
original.org.osiam.html.form.fields=fieldName:required
original.org.osiam.html.form.fields=formattedName:true\
,familyName:false\
,givenName:true