grails-spring-security-rest | Grails plugin to implement token | Authentication library
kandi X-RAY | grails-spring-security-rest Summary
kandi X-RAY | grails-spring-security-rest Summary
Spring Security REST for Grails.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of grails-spring-security-rest
grails-spring-security-rest Key Features
grails-spring-security-rest Examples and Code Snippets
Community Discussions
Trending Discussions on grails-spring-security-rest
QUESTION
I'm trying to build my first grails application using grails-spring-security-rest plugin following this post's instructions.
However, when I try to run the application it gives me the following output:
...ANSWER
Answered 2017-May-09 at 18:23Finally, I was able to fix the problem:
Issue 1: I created User Role and UserRole classes manually instead of using
QUESTION
I am using the application.yml file to load runtime configurations for the grails-spring-security-rest plugin.
...ANSWER
Answered 2018-Jul-13 at 14:14You could create an application.groovy and a runtime.groovy in place of the yml. The external config plug-in has a script for converting from yml to Groovy config: http://plugins.grails.org/plugin/grails/external-config
QUESTION
I've been trying to implement Facebook OAuth from here: http://alvarosanchez.github.io/grails-spring-security-rest/latest/docs/index.html#_delegating_authentication_to_oauth_providers
I'm able to integrate OAuth and get the access token from Facebook but I'm facing problem implementing a custom OAuthUserDetailsService. I've created a custom service:
FacebookOauthUserDetails.groovy
...ANSWER
Answered 2017-Dec-27 at 10:10GrailsUserDetailsService
is the interface basically reside in theorg.springframework.security.core.userdetails
package. You can implement the loadUserByUsername
method of above service (interface) in your service (class) and write a code (implementation) to get your desired data / userdetails, you can get the user details as object/list/map whatever format you want, you can find data there by GORM finder method by the given username and return that data.
Below is sample example,
Service code:
QUESTION
What I'm trying to do is login a user and get a token back (this part works). Then I want to validate this token every time I access an API path. I'm obviously doing something wrong, maybe I don't fully understand what the Spring Security Rest plugin is actually supposed to do but whenever I call an API path and send the token all I get back is the Spring Security login page's html. I'm using Boomerang Soap and Rest Client. Here's what I'm sending.
Login Request (path: http://localhost:7070/backend3/api/login
):
ANSWER
Answered 2017-Aug-04 at 04:34Seems that the issue is: your url http://localhost:7070/backend3/external/user/info
is not under /api/** so the regular spring security filter chain is being invoked instead of the rest api filter chain.
Try
QUESTION
I'm using Grails Spring Security Core and the Grails Spring Security REST plugin and I'm just starting to get things set up. I initialized the plugins with a User
class and an Authority
class (defaults) and went to write an integration test, following a guide I found on the Grails website.
It said to put the following in an integration test:
...ANSWER
Answered 2017-Jul-30 at 01:37The User you create in the given section is in a transaction that has not been committed. When you make the REST call, the api/login controller will be run in a new transaction that cannot see your un-committed User.
A few options (there are others)...
Create User in BootStrap.groovy
QUESTION
I have a similar requirement like this post mentioned. :REST spring security - Manually authenticating a new user and getting access token
According to the accepted answer, the codes will be like:
...ANSWER
Answered 2017-Jun-06 at 03:29Well if you want to use the "tokenGenerator"
then you need to register it under the "resources.groovy"
like below
QUESTION
In my Grails 3.2.9 web-app I'm using Spring Security plugin to manage user session. This is the depencency:
...ANSWER
Answered 2017-Jun-02 at 10:26I do not have experience in Grails but perhaps what you are looking for can be implemented by providing a different implementation of org.springframework.security.web.AuthenticationEntryPoint
in your Spring security configuration. By default for form authentication Spring uses org.springframework.security.web.authentication.LoginUrlAuthenticationEntryPoint
which performs redirect to the given login page. On the other hand org.springframework.security.web.authentication.HttpStatusEntryPoint
just returns the desired status.
In our project entry point is set in the old fashioned way through XML configuration:
QUESTION
Seems like facebook has changed the response format of api call now my code is not working as it suppose to be. I've followed exact same steps to configure plugin mention @ plugin docs
I'm facing exact same issue mentioned in grails-spring-security-rest/issues/327
Any workaround/hints to get facebook connect work with grails-spring-security-rest plugin?
...ANSWER
Answered 2017-Apr-28 at 14:01https://github.com/alvarosanchez/grails-spring-security-rest/issues/327#issuecomment-296610128
Someone has posted a workaround.
QUESTION
I'm setting the security system on my project (Grails - Angularjs) with Spring Security Rest Plugin v1.5.4 (using spring security core 2.0.0) for Grails 2.4.4. Doc about this plugin can be found here.
I'm testing the login and logout with postman chrome rest client and I'm able to do a login OK, but I'm getting a 404 when I do logout.
In the documentation clearly says:
The logout filter exposes an endpoint for deleting tokens. It will read the token from an HTTP header. If found, will delete it from the storage, sending a 200 response. Otherwise, it will send a 404 response
You can configure it in Config.groovy using this properties:
Config key...................................................................................Default value
grails.plugin.springsecurity.rest.logout.endpointUrl....................../api/logout grails.plugin.springsecurity.rest.token.validation.headerName....X-Auth-Token
So, after doing a login successfully, I tried to do a logout to that url (my_host_url/api/logout) with a GET method and sending a header X-Auth-Token with the token I got previously from login.
But I keep getting a 404. See image below
Edit: I'm setting the chain map like this (in order to get a stateless behavior):
...ANSWER
Answered 2017-Jan-19 at 16:53You missed another excerpt from the docs. It's a warning message literally before the chunk you quoted, and says:
Logout is not possible when using JWT tokens (the default strategy), as no state is kept in the server.
If you still want to have logout, you can provide your own implementation by creating a subclass of
JwtTokenStorageService
and overriding the methodsstoreToken
andremoveToken
. Then, register your implementation inresources.groovy
astokenStorageService
.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install grails-spring-security-rest
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page