Last active
August 29, 2015 14:02
-
-
Save alvarosanchez/81968cb76bcf547e9de1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.odobo.gr8conf.Category | |
import com.odobo.gr8conf.Game | |
import org.springframework.security.core.authority.SimpleGrantedAuthority | |
import org.springframework.security.core.userdetails.User | |
import org.springframework.security.core.userdetails.UserDetails | |
import org.springframework.security.provisioning.UserDetailsManager | |
class BootStrap { | |
UserDetailsManager userDetailsService | |
def init = { servletContext -> | |
def slot = new Category(name: 'Slot').save() | |
def instantWin = new Category(name: 'Instant Win').save() | |
def card = new Category(name: 'Card').save() | |
def cascade = new Category(name: 'Cascade').save() | |
def table = new Category(name: 'Table').save() | |
def castleBuilder = new Game(name: 'Castle Builder').addToCategories(slot).save() | |
def amazingCircus = new Game(name: 'The Amazing Circus').addToCategories(instantWin).save() | |
def pokerDrop = new Game(name: 'Poker Drop Riches').addToCategories(card).addToCategories(cascade).save() | |
def petsPayDay = new Game(name: "Pet's Pay Day").addToCategories(slot).save() | |
def grandBlackjack = new Game(name: 'Grand Blackjack').addToCategories(card).addToCategories(table).save() | |
UserDetails jimi = new User('user', 'password', [new SimpleGrantedAuthority('ROLE_USER'), new SimpleGrantedAuthority('ROLE_ADMIN')]) | |
userDetailsService.createUser(jimi) | |
} | |
def destroy = { | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// log4j configuration | |
log4j = { | |
// Example of changing the log pattern for the default console appender: | |
// | |
//appenders { | |
// console name:'stdout', layout:pattern(conversionPattern: '%c{2} %m%n') | |
//} | |
error 'org.codehaus.groovy.grails.web.servlet', // controllers | |
'org.codehaus.groovy.grails.web.pages', // GSP | |
'org.codehaus.groovy.grails.web.sitemesh', // layouts | |
'org.codehaus.groovy.grails.web.mapping.filter', // URL mapping | |
'org.codehaus.groovy.grails.web.mapping', // URL mapping | |
'org.codehaus.groovy.grails.commons', // core / classloading | |
'org.codehaus.groovy.grails.plugins', // plugins | |
'org.codehaus.groovy.grails.orm.hibernate', // hibernate integration | |
'org.springframework', | |
'org.hibernate', | |
'net.sf.ehcache.hibernate' | |
debug 'com.odobo', | |
'grails.app.controllers.com.odobo', | |
'grails.app.services.com.odobo' | |
} | |
grails.cache.config = { | |
cache { | |
name 'tokens' | |
} | |
} | |
grails { | |
plugin { | |
springsecurity { | |
rest { | |
login { | |
useJsonCredentials = true | |
} | |
token { | |
storage { | |
useGrailsCache = true | |
grailsCacheName = 'tokens' | |
} | |
} | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.odobo.gr8conf.Category | |
import com.odobo.gr8conf.Game | |
import grails.rest.render.hal.HalJsonCollectionRenderer | |
import grails.rest.render.hal.HalJsonRenderer | |
import org.springframework.security.authentication.encoding.PlaintextPasswordEncoder | |
import org.springframework.security.provisioning.InMemoryUserDetailsManager | |
// Place your Spring DSL code here | |
beans = { | |
categoriesRenderer(HalJsonCollectionRenderer, Category) | |
categoryRenderer(HalJsonRenderer, Category) | |
gamesRenderer(HalJsonCollectionRenderer, Game) | |
gameRenderer(HalJsonRenderer, Game) | |
userDetailsService(InMemoryUserDetailsManager, []) | |
passwordEncoder(PlaintextPasswordEncoder) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment