Skip to content

Instantly share code, notes, and snippets.

View william-tran's full-sized avatar

Will Tran william-tran

  • Toronto, ON, Canada
View GitHub Profile
@william-tran
william-tran / ExecutorDemoApplication.java
Created May 26, 2017 19:49
Thread management sample using spring and executors.
package com.example.lombokdemo;
import javax.annotation.PostConstruct;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;
@william-tran
william-tran / multitenant-endpoints.xml
Created February 19, 2015 01:37
Checking the path for identtiy-zones/uaa in the xml config
<http name="identityZoneSecurity" pattern="/identity-zones/**" create-session="stateless" entry-point-ref="oauthAuthenticationEntryPoint"
use-expressions="true" authentication-manager-ref="emptyAuthenticationManager" xmlns="http://www.springframework.org/schema/security">
<intercept-url pattern="/**" access="#oauth2.hasScope('zones.create') and not request.requestURI.contains('/identity-zones/'[email protected])" method="GET"/>
</http>
@william-tran
william-tran / IdentityZoneEndpoints.java
Created February 19, 2015 01:34
Method security annotation
@RestController
@RequestMapping("/identity-zones")
public class IdentityZoneEndpoints {
@PreAuthorize("#id != @uaaIdentityZone.id")
@RequestMapping(value="{id}", method = GET)
public IdentityZone getIdentityZone(@PathVariable String id) {
return zoneDao.retrieve(id);
}