Grails Spring Security UI 403 After overriding auth - jquery-ui

I get a 403 error accessing
http://localhost:8080/tests2ui/plugins/jquery-ui-1.10.4/jquery-ui/themes/ui-lightness/jquery-ui-1.10.4.custom.css
during login, after overriding spring security auth.gsp using
s2ui-override auth
From previous tests, I can determine that the login is successful.
The steps I performed are:
Added plugins to BuildConfig.groovy plugins closure:
compile ":spring-security-core:2.0-RC4"
compile ":mail:1.0.7"
compile ":jquery-ui:1.10.4"
compile ":famfamfam:1.0.1"
compile ":spring-security-ui:1.0-RC2"
Create user and role domains
s2-quickstart tests2ui User Role
Added Users and Roles to BootStrap.goovy
Compile and run app. I am able to log in without errors.
Override the auth.gsp using
s2ui-override auth
Compile and run app. I get the access denied on the URL
http://localhost:8080/tests2ui/plugins/jquery-ui-1.10.4/jquery-ui/themes/ui-lightness/jquery-ui-1.10.4.custom.css
I am using GGTS v3.6.1 and Grails 2.4.3 on a Windows 7 machine.
Any suggestions of what I'm doing wrong?

as noted here:
grails spring security ui login weird redirect sometimes
The answer is to include a '/plugins/**' : ['permitAll'] in grails.plugins.springsecurity.controllerAnnotations.staticRules.

Related

Run grails 3 project at customized url

I have a project which uses Grails 3 on Intellij IDE. When I run my project I get my URL like this:
Now I want to run by project at http://localhost:8080/login/auth where I have a login page.
I tried changing server Context path and urlMapping. But both didn't work. I am using Spring Security Core-3 as authentication plugin.

Grails 3.0 and Spring Security

I'm using Grails 3.0.1 with IntelliJ Idea and I'm trying to use Spring Security plugin on my project.
I know that old spring-seurity-core plugin is not compatible with Grails 3.0 version. Thus I've tried to follow this tutorial: http://spiesdavid.blogspot.fi/2015/03/grails-3-app-with-security-part-1.html
I've added the compile line in build.gradle file in dependencies. I've also added the logger line in logback.groovy file.
Problems start after that. There is no such file as SecurityConfiguration.groovy and there is no org.springframework.security package so I can't import them and it gives an error. So I can't create the file either.
So I am assuming that your question is: «How do I get this to work?»
spring security plugin 3.0.0 (for grails 3.x) was released just a few days ago. Documentation is quite good. Start here: https://grails-plugins.github.io/grails-spring-security-core/
There are some problems with Intellij. I tried to add spring security to a slightly older grails project (started with intellij 15.0.1 and grails 3.0.9). Adding the dependencies was successful and rebuilding it made the plugin available, also in the grails console. But when I launched a debug instance of the application directly from the IDE, it would not show spring security among the loaded/installed plugins. I made a pristine project with IntelliJ 15.02, grails 3.0.10 and just copied my code over to the new project. Now it works.
Note there are some issue with IntelliJ not major. do the following it will work:
on your build.gradle add compile 'org.grails.plugins:spring-security-core:3.0.0.M2'
run command compile
run comand s2-quickstart yourAppName User Role
now you should see "application.groovy" file under conf folder
as usual use #Secured annotation in your controller

Getting an auth error when calling a Grails plugin that uses mongodb

I have created a mongo database plugin for my application. Right now the mongodB does not have any users created. When I run the plugin directly I can successfully run all of my defined CRUD activities. When I include the plugin in my GRAILS application, get a handle to the plugins data service and call any CRUD activity I get:
"serverUsed" : "localhost:27017" , "ok" : 0.0 , "errmsg" : "auth failed" , "code" : 18
Since I don't have auth defined in my Mongo running instance and since I am successful when running my plugin directly I am confused as to whyu I get an auth error once I have added the plugin to my application BuildConfig and attempt to access it from the app.
any suggestions?
when you install your plugin into an app, the plugin's DataSource and Config are ignored. So you have to repeat the definition of your mongodb-datasource in the main app

How to add truststore in Grails plugin?

I'm writing a Grails plugin for internal Grails apps to use. I need the plugin to install a truststore (and inside of it, an added SSL cert) and make it available to whatever Grails app includes it as a compile-time plugin.
Hence, if my truststore is called cacerts.jks, and the name of the SSL cert stored therein is called myssl.cer, when the user adds the following to their Grails app's BuildConfig.groovy:
plugins {
compile ":myplugin:VERSION"
}
...then the Grails app will trust the myssl.cer that is stored in its JKS.
Any ideas as to how to accomplish this?

Spring Security UI plugin for Grails creates neither spring-security-ui.css nor i18n files

I'm using Eclipse STS. I executed:
grails s2-quickstart seguridad Usuario Rol Requestmap
grails s2ui-override auth
grails s2ui-override layout
Domain, controller and view files for login where created:
layout/springSecurityUI.gsp
login/auth.gsp (has been overwritten after grails s2ui-override auth)
...
But these files have not been created:
web-app/css/spring-security-ui.css
grails-app/i18n/messages.spring-security-ui.properties
This is a screenshot of the login result:
Should I do something else to create the css file so it look beautiful?
Try extracting the files from the directory you need, from the version you need
https://github.com/grails-plugins/grails-spring-security-ui/tree/master/grails-app/assets/stylesheets
https://github.com/grails-plugins/grails-spring-security-ui/tree/master/grails-app/i18n

Resources