How to import Authentication and SecurityContextHolder in grails - spring-security

I want to logout manually and I use Grails Redirect Post-Logout Using spring-security-core-3.0.6+ to resolve my issues but there is an error of "Unable to resolve Authentication" so can anyone help me how to import Authentication and SecurityContextHolder in grails?

Here is how you imported:
import org.springframework.security.core.Authentication
import org.springframework.security.core.context.SecurityContextHolder

Related

springSecurityService add second authentication before building roles

I am using springSecurityService.
my flow is as followed:
step #1 :springSecurityService should check user & password.
if succeeds,
step #2: check second authentication.
if succeeds,
step #3: build roles and log in.
I tried implementing in many ways but no success, can someone please advise?
Just to clarify, basically what i need id a two-factor authentication.
Thanks!
step 1:
install spring security plugin, for other setting read this
step 2 :
use s2-quickstart , example :
grails s2–quickstart com.yourapp.security User Role RequestMap
step 3 :
configure your first account(User / Role / RequestMap) to login in bootstrap..
read this
then you can try to login with default form by spring security..
in grails 3.0 + , you can read this
so in grails 3.0+, you will get default loginController.groovy and UsernamePasswordAuthenticationFilter.groovy by spring security
but if you use grails 2.0+, you can find loginController.groovy in root of your controller's folder...and you can find out UsernamePasswordAuthenticationFilter.groovy too..but i forget that location..you can search it with tools like Intellij or other..

Grails - Spring Security and LDAP mapping to database

I am validating the users of my application with LDAP, and it works.
But now I need to assign my own roles and map them to my database.
I have been following a few tutorials, like this: https://chlebik.wordpress.com/2014/10/27/ldap-authentication-and-db-authorisation-with-grails-spring-security/
My problem is that my imports have errors because Grails doesn´t found the classes. For example:
import org.codehaus.groovy.grails.plugins.springsecurity.GrailsUserDetailsService
import org.springframework.security.core.authority.GrantedAuthorityImpl
import org.springframework.security.core.userdetails.UserDetails
I am using Grails 2.4.4
My plugins in config.groovy:
compile ":spring-security-core:2.0-RC4"
compile ":spring-security-ldap:2.0-RC2"
If you need any information, tell to me please.
Any help or tutorial would be good.
Those would be
import grails.plugin.springsecurity.userdetails.GrailsUserDetailsService
import org.springframework.security.core.authority.SimpleGrantedAuthority
import org.springframework.security.core.userdetails.UserDetails
The source is here and the docs include a section on changes made in the 2.0 plugin.

OAuth 2.0 for Grails without Spring security

I am currently implementing Shiro-Authentication along with OAuth for Google SignIn. It all works great and lets me authenticate a gmail account against a users email in my database.
My build config looks as follows:
//User roles and permissions
compile (":shiro:1.2.0") {
excludes "servlet-api"
excludes "shiro-quartz"
}
//Google SignIn
compile ":oauth:2.1.0"
The only issue I am having is that when google requests permission for my application, I get this:
When I was expecting something more like this:
It is clearly still using OAuth 1.0 and not 2.0.
I have read many questions on here and the closest I have found is this Google consent screen not shown as expected .
The only issue with this implementation is that it uses Spring security and I am using Shiro. When I try use the spring plugin, I keep coming up against this issue when I try to compile it:
| Error The following artifacts could not be resolved: org.springframework.security:spring-security-core:jar:3.2.0.RC1, org.springframework.security:spring-security-web:jar:3.2.0.RC1: Could not find artifact org.springframework.security:spring-security-core:jar:3.2.0.RC1 in grailsCentral (http://repo.grails.org/grails/plugins)
| Run 'grails dependency-report' for further information.
IDEA hook: Grails not found!
| Error java.lang.NullPointerException
| Error at org.jetbrains.groovy.grails.rt.Agent$2.run(Agent.java:135)
| Error at java.lang.Thread.run(Thread.java:695)
Any tips or suggestions are greatly appreciated.
Cheers.
I have create a sample grails application that uses oauth plugin for google authentication with oauth2.
Have a try.
I have created a new java file in src/java as suggested here, and using this in my google configurations in Config.groovy.
I have provided the full solution here.

How to access a wsdl URL in SoapUI, which recquires username/password?

How to access a wsdl URL in SOAPUI, which recquires username/password ?
http://localhost:8080/ws/hello1?wsdl
There is a bug with retrieving password protected WSDLs in SoapUI 4.6.4. The bug is fixed 5.0.0 and can be downloaded from http://www.soapui.org/
Hopefully this will solve your problem.
When you create new project using wsdl or add a wsdl in existing project for a secure webservice, it asks for user id and password several times the simple solution is adding myuser:mypassword#
https://myuser:mypassword#mywebservice:9052/sdv/ErpHub/1.0?wsdl

How to enable http logging for provisioning API java client?

I am using java classes AppsForYourDomainService UserService
from package com.google.gdata.client and could not figure out how to configure http client log.
any ideas?
There's an excellent article detailing how to do this at:
https://developers.google.com/gdata/articles/debugging_client_libs#java

Resources