尝试使用Grails Spring Security Plugin + Facebook Connect自动创建具有身份验证的默认权限的用户 [英] Trying to use Grails Spring Security Plugin + Facebook Connect to automatically create a user with default permissions on Authentication

查看:125
本文介绍了尝试使用Grails Spring Security Plugin + Facebook Connect自动创建具有身份验证的默认权限的用户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用一个使用Spring(Acegi)插件进行Grails的应用程序。该插件具有内置的Facebook连接设置。我已经按照说明处理在应用程序中的Facebook登录...但是,我对于正在发生的事情的了解很弱,我真正想做的是给用户/访问者选择使用他们的Facebook帐户登录或注册我的应用程序或手动创建帐户。我在Spring Security插件中的应用程序中设置了使用facebook连接登录选项绕过的角色。在哪里可以拦截Spring Security插件中的登录操作,以注入自己的自定义代码,以在应用程序中创建新用户,如果他/她不存在。

I am working on an app that uses the Spring (Acegi) plugin for Grails. The plugin has facebook connect settings built in. I have followed the instructions to handle a facebook login within the app... however my knowledge of exactly whats going on is weak and what I really would like to do is give the user/visitor the option of either logging in and or registering on my app using their facebook account or create an account manually. I have roles that are setup in the app in the Spring Security plugin that are being bypassed using the facebook connect login option. Where can I intercept the login action in the Spring Security plugin to inject my own custom code to create the new user within the app if he/she doesnt exist.

我希望如果他们选择使用Facebook创建一个帐户..我的应用程序将为具有默认权限的Facebook用户创建一个相应的帐户。当人员登录时,设置权限并访问某些内容需要验证。

My hope is that if they choose to create an account using facebook.. my app will create a corresponding account for the facebook user with default permissions. When the person logs in, permissions are set and authentication is required to access certain content.

我发现了一种使用Shiro Security插件来处理这个问题的方法:

I found a way of handling this using the Shiro Security plugin here:

http://sacharya.com/facebook-connect-with-jsecurity-on-grails/

我也绊倒了敏捷。但是,我真的很喜欢Spring Security,可能只是一个安慰的事情,也许它的时间让我用Nimble尝试Shiro ..我不知道。

I also stumbled upon Nimble. However, I really like Spring Security, could just be a comfort thing and maybe its time for me to try Shiro with Nimble.. I dont know.

我希望这是有道理的。我感激任何方向使这种情况发生。

I hope this makes sense. I appreciate any direction in making this happen.

最佳
Mike

Best Mike

推荐答案

一个实现ApplicationListener的SecurityListener类?

Have you tried using a SecurityListener class implementing a ApplicationListener?


public void onApplicationEvent(ApplicationEvent event) 
{
    if (event instanceof AuthenticationSuccessEvent) 
    {
        ...
    }
}

另见: http://forum.springsource.org/showthread.php?t=66885

这篇关于尝试使用Grails Spring Security Plugin + Facebook Connect自动创建具有身份验证的默认权限的用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆