Prerequisites
- Tomcat 6+
Configuration
- Add your google credentials to application.properties
- Add your google user to src/main/sample/application/dao/impl/HardCodedUserDetailsDAO i.e. change users.put("test.manager@gmail.com", managerRoles);
- build.gradle configure cargo to point at your Tomcat:
cargo {
containerId = 'tomcat7x'
port = 8080
local {
homeDir = file('/ApplicationServers/apache-tomcat-7.0.41')
output = file('/ApplicationServers/apache-tomcat-7.0.41/output.log')
}
}Running
- gradle clean build
- gradle cargoStartLocal
- Browser http://localhost:8080/sample-security-google-auth/
(Should see welcome)
- Click link 'Click To Enter Sample Application' 5a. If not already logged into Google, you will be redirected prompted for your credentials then redirected back and displayed:
Hello User
5b. If you were already logged in, you should be just be redirected and presented with the same message as above.
TODOs
- Replace System.outs with Log4J
- Secure (HTTPS) redirect URL to protect against interception of token.