Skip to content

Instantly share code, notes, and snippets.

View JacobASeverson's full-sized avatar

Jacob Severson JacobASeverson

  • Favor
  • Austin, TX
View GitHub Profile
@JacobASeverson
JacobASeverson / grailsJndiServerXmlClip
Last active December 30, 2015 18:19
Gist for OPI Blog post "Grails Config Values Per Tomcat Host"
// Clip of server.xml file with multiple hosts that need
// environment variables for Grails to pull in.
<Host name="foo1.com" appBase="foo1" ...>
...
</Host>
<Host name="foo2.com" appBase="foo2" ...>
...
</Host>
<Host name="foo3.com" appBase="foo3" ...>
@JacobASeverson
JacobASeverson / grailsJndiOldExtConfig
Last active December 30, 2015 18:19
Gist for OPI Blog post "Grails Config Values Per Tomcat Host"
// This usual method of external configuration won't work since
// each Host will point to the same applicationConfig file
grails.config.locations = [ "file:/path/to/applicationConfig.groovy"]
@JacobASeverson
JacobASeverson / grailsJndiGrailsConfig
Last active December 30, 2015 18:19
Gist for OPI Blog post "Grails Config Values Per Tomcat Host"
...
try {
exConfig = ((Context)(new InitialContext().lookup("java:comp/env"))).lookup("grailsExtConfFile")
} catch (Exception e) {
println("External configuration lookup failed: " + e)
}
grails.config.locations = ["${exConfig}"]
@JacobASeverson
JacobASeverson / grailsJndiLocalConfig
Last active December 30, 2015 18:19
Gist for OPI Blog post "Grails Config Values Per Tomcat Host"
...
if (Environment.current in [Environment.DEVELOPMENT, Environment.TEST]) {
exConfig = "file:/path/to/local/applicationConfig.groovy"
} else {
try {
exConfig = ((Context)(new InitialContext().lookup("java:comp/env"))).lookup("grailsExtConfFile")
...
@JacobASeverson
JacobASeverson / WebSecurityConfig
Last active August 25, 2017 07:04
Example java config for using CAS with Spring Security
@Configuration
@EnableWebMvcSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
@Bean
public ServiceProperties serviceProperties() {
ServiceProperties serviceProperties = new ServiceProperties();
serviceProperties.setService("https://localhost:8443/cas-sample/j_spring_cas_security_check");
serviceProperties.setSendRenew(false);
return serviceProperties;
<security:user-service id="userService">
<security:user name="joe" password="joe" authorities="ROLE_USER" />
...
</security:user-service>
public class TestCasAuthenticationUserDetailsService implements AuthenticationUserDetailsService {
@Override
public UserDetails loadUserDetails(Authentication token) throws UsernameNotFoundException {
List<GrantedAuthority> authorities = new ArrayList<>();
authorities.add(new SimpleGrantedAuthority("ROLE_USER"));
return new User("joe", "joe", authorities);
}
}
@JacobASeverson
JacobASeverson / reactorUdpBuild
Created November 11, 2014 03:30
Building and running the udp-reactor.
git clone https://github.com/JacobASeverson/udp-reactor.git
cd udp-reactor/
./gradlew build
java -jar build/libs/udp-reactor-0.0.1-SNAPSHOT.jar
@JacobASeverson
JacobASeverson / UdpPacketToServer
Last active August 29, 2015 14:09
Sending a UDP packet to the Reactor server.
echo -n 'Success!' | nc -4u -w1 localhost $UDP_SERVER_PORT
@JacobASeverson
JacobASeverson / pullInstallVertxExample
Last active August 29, 2015 14:09
Pulling and installing the Vert.x fat jar example.
git clone https://github.com/JacobASeverson/vertx-fatjar-example.git
cd vertx-fatjar-example/world-mod/
./gradlew install