No description
  • Groovy 86.4%
  • Shell 8.3%
  • Java 5.3%
Find a file
2026-05-20 13:23:29 +02:00
gradle/wrapper Version 2.0 for GRAILS 7.0 2025-10-28 16:17:44 +01:00
grails-app Version 2.0 for GRAILS 7.0 2025-10-28 16:17:44 +01:00
src/main/groovy/de/ctag/auth5 Version 2.0 for GRAILS 7.0 2025-10-28 16:17:44 +01:00
.editorconfig upgrade dependencies and .editorconfig 2023-03-29 10:21:21 +02:00
.gitignore Initial commit 2023-02-08 09:50:22 +01:00
.sdkmanrc update to GRAILS 7.0.11 2026-05-20 13:23:17 +02:00
build.gradle update to GRAILS 7.0.11 2026-05-20 13:23:17 +02:00
cleanLocalCache.sh Initial commit 2023-02-08 09:50:22 +01:00
gradle.properties update to GRAILS 7.0.11 2026-05-20 13:23:17 +02:00
gradlew Version 2.0 for GRAILS 7.0 2025-10-28 16:17:44 +01:00
grails-wrapper.jar Version 2.0 for GRAILS 7.0 2025-10-28 16:17:44 +01:00
grailsw Version 2.0 for GRAILS 7.0 2025-10-28 16:17:44 +01:00
publish.sh Version 2.0 for GRAILS 7.0 2025-10-28 16:17:44 +01:00
README.md update README.md 2026-05-20 13:23:29 +02:00
settings.gradle Version 2.0 for GRAILS 7.0 2025-10-28 16:17:44 +01:00

ct@g authentication plugin for GRAILS > 7.x

Using spring-security.

application.yml

grails :
  plugin :
    springsecurity :
      password :
        algorithm : 'SHA-1'                # not used but needed if we use the new Sha1ToBCryptPasswordEncoder
        hash :
          iterations : 1
      userLookup :
        userDomainClassName : de.ctag.auth5.domain.User
        authorityJoinClassName : de.ctag.auth5.domain.UserRole
        usernamePropertyName : 'username'
        passwordPropertyName : 'password'
        authoritiesPropertyName : 'roles'
        enabledPropertyName : 'accountEnabled'
        accountExpiredPropertyName : 'accountExpired'
        accountLockedPropertyName : 'accountLocked'
        passwordExpiredPropertyName : 'credentialsExpired'
      authority :
        className : de.ctag.auth5.domain.Role
        nameField : 'name'

resources.groovy


/**
 * Our own implementation which can handle the 'accountEnabled' state of users
 * https://grails.github.io/grails-spring-security-core/5.1.1/#userDetailsService
 */
userDetailsService( CtagUserDetailsService ) {
	grailsApplication = ref( 'grailsApplication' )
}

userRoleLookupService( CtagUserRoleLookupService )

// Automatically encode passwords in the User domain tables
userPasswordEncoderListener( UserPasswordEncoderListener )

/**
 * Since legacy Apps are using SHA-1 encoding, but now we use BCrypt (from SHA-1),
 * we need this to support both formats.
 * There is also a GRAILS Listener, which takes care that passwords are encoded everytime a User.password is changed.
 * This Listener also detects the format, and handles correctly.
 */
// encode as BCrypt (from SHA1) but decode both by detecting the String at start
passwordEncoder( Sha1ToBCryptPasswordEncoder )


Sha1ToBCryptPasswordEncoder

This is a Spring security password encoder which can handle our old SHA-1 AND the new BCRYPT hashes.

  • If the password is plain text, then first it generated the old SHA-1 hash, and then the new BCRYPT hash.
  • If the password is SHA-1, then it generates the new BCRYPT hash.
  • If the password already BCRYPT, then it does nothing.

Therefore, the new passwort gets a prefix: '{brypt}'

BCryptPasswordEncoder

The native spring security BCRYPT password encoder.

Password is encoded using brypt und stored like "$2a............."