Skip to content

Commit

Permalink
First release
Browse files Browse the repository at this point in the history
  • Loading branch information
marcpalmer committed Jan 6, 2011
0 parents commit 1adabf9
Show file tree
Hide file tree
Showing 9 changed files with 183 additions and 0 deletions.
12 changes: 12 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

87 changes: 87 additions & 0 deletions WeceemSpringSecurityGrailsPlugin.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
class WeceemSpringSecurityGrailsPlugin {
// the plugin version
def version = "1.0-RC1"
// the version or versions of Grails the plugin is designed for
def grailsVersion = "1.3.1 > *"
// the other plugins this plugin depends on
def dependsOn = [springSecurityCore:'1.0.1 > *']

// resources that are excluded from plugin packaging
def pluginExcludes = [
"grails-app/views/error.gsp"
]

def author = "Marc Palmer"
def authorEmail = "info@weceem.org"
def title = "Bridges Weceem authentication to Spring Security"
def description = '''\\
Provides the glue needed to make Weceem plugin use Spring Security for authorisation and authentication.
Your application still needs to configure Spring-Security however. The domain class is expected to include "email" property.
'''

// URL to the plugin's documentation
def documentation = "http://grails.org/plugin/weceem-spring-security"

def doWithWebDescriptor = { xml ->
// TODO Implement additions to web.xml (optional), this event occurs before
}

def doWithSpring = {
// TODO Implement runtime spring config (optional)
}

def doWithDynamicMethods = { ctx ->
// TODO Implement registering dynamic methods to classes (optional)
}

def doWithApplicationContext = { applicationContext ->
def authenticateService = applicationContext.springSecurityService
applicationContext.wcmSecurityService.securityDelegate = [
getUserName : { ->
def princ = authenticateService.principal
if (log.debugEnabled) {
log.debug "Weceem security getUserName callback - user principal is: ${princ} (an instance of ${princ?.class})"
}
if (princ instanceof String) {
return null
} else {
return princ.username
}
},
getUserEmail : { ->
def princ = authenticateService.principal
if (log.debugEnabled) {
log.debug "Weceem security getUserEmail callback - user principal is: ${princ} (an instance of ${princ?.class})"
}
return (princ instanceof String) ? null : princ.domainClass?.email
},
getUserRoles : { ->
def princ = authenticateService.principal
if (log.debugEnabled) {
log.debug "Weceem security getUserRoles callback - user principal is: ${princ} (an instance of ${princ?.class})"
}
if (princ instanceof String) {
return ['ROLE_GUEST']
}
def auths = []
auths.addAll(princ.authorities)
return auths ?: ['ROLE_GUEST']
},
getUserPrincipal : { ->
authenticateService.principal
}
]
}

def onChange = { event ->
// TODO Implement code that is executed when any artefact that this plugin is
// watching is modified and reloaded. The event contains: event.source,
// event.application, event.manager, event.ctx, and event.plugin.
}

def onConfigChange = { event ->
// TODO Implement code that is executed when the project configuration changes.
// The event is the same as for 'onChange'.
}
}
7 changes: 7 additions & 0 deletions application.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#Grails Metadata file
#Wed Jan 05 14:43:38 GMT 2011
app.grails.version=1.3.6
app.name=WeceemSpringSecurity
plugins.hibernate=1.3.6
plugins.spring-security-core=1.0.1
plugins.tomcat=1.3.6
31 changes: 31 additions & 0 deletions dependencies.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
grails.project.class.dir = "target/classes"
grails.project.test.class.dir = "target/test-classes"
grails.project.test.reports.dir = "target/test-reports"
//grails.project.war.file = "target/${appName}-${appVersion}.war"
grails.project.dependency.resolution = {
// inherit Grails' default dependencies
inherits("global") {
// uncomment to disable ehcache
// excludes 'ehcache'
}
log "warn" // log level of Ivy resolver, either 'error', 'warn', 'info', 'debug' or 'verbose'
repositories {
grailsPlugins()
grailsHome()
grailsCentral()

// uncomment the below to enable remote dependency resolution
// from public Maven repositories
//mavenLocal()
//mavenCentral()
//mavenRepo "http://snapshots.repository.codehaus.org"
//mavenRepo "http://repository.codehaus.org"
//mavenRepo "http://download.java.net/maven/2/"
//mavenRepo "http://repository.jboss.com/maven2/"
}
dependencies {
// specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes eg.

// runtime 'mysql:mysql-connector-java:5.1.13'
}
}
Binary file added grails-weceem-spring-security-1.0-RC1.zip
Binary file not shown.
21 changes: 21 additions & 0 deletions plugin.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<plugin name='weceem-spring-security' version='1.0-RC1' grailsVersion='1.3.1 &gt; *'>
<author>Marc Palmer</author>
<authorEmail>info@weceem.org</authorEmail>
<title>Bridges Weceem authentication to Spring Security</title>
<description>\
Provides the glue needed to make Weceem plugin use Spring Security for authorisation and authentication.

Your application still needs to configure Spring-Security however. The domain class is expected to include "email" property.
</description>
<documentation>http://grails.org/plugin/weceem-spring-security</documentation>
<resources>
<resource>BuildConfig</resource>
<resource>Config</resource>
<resource>DataSource</resource>
<resource>UrlMappings</resource>
</resources>
<dependencies>
<plugin name='springSecurityCore' version='1.0.1 &gt; *' />
</dependencies>
<behavior />
</plugin>
10 changes: 10 additions & 0 deletions scripts/_Install.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
//
// This script is executed by Grails after plugin was installed to project.
// This script is a Gant script so you can use all special variables provided
// by Gant (such as 'baseDir' which points on project base dir). You can
// use 'ant' to access a global instance of AntBuilder
//
// For example you can create directory under project tree:
//
// ant.mkdir(dir:"${basedir}/grails-app/jobs")
//
5 changes: 5 additions & 0 deletions scripts/_Uninstall.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
//
// This script is executed by Grails when the plugin is uninstalled from project.
// Use this script if you intend to do any additional clean-up on uninstall, but
// beware of messing up SVN directories!
//
10 changes: 10 additions & 0 deletions scripts/_Upgrade.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
//
// This script is executed by Grails during application upgrade ('grails upgrade'
// command). This script is a Gant script so you can use all special variables
// provided by Gant (such as 'baseDir' which points on project base dir). You can
// use 'ant' to access a global instance of AntBuilder
//
// For example you can create directory under project tree:
//
// ant.mkdir(dir:"${basedir}/grails-app/jobs")
//

0 comments on commit 1adabf9

Please sign in to comment.