如何将 Joomla 登录会话从一个 joomla 网站共享到一个 ASP.Net MVC 网站 [英] How to share Joomla login session from one joomla website to one ASP.Net MVC website

查看:18
本文介绍了如何将 Joomla 登录会话从一个 joomla 网站共享到一个 ASP.Net MVC 网站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 Joomla 站点和另一个基于 ASP.NET MVC 的 Web 应用程序.我希望在登录 Joomla 网站后自动登录另一个应用程序.

I have one Joomla site and another web app which is ASP.NET MVC based. I am wishing to do auto login to another app after login to Joomla website.

例如,是否有可能在成功登录 Joomla 网站后,自动向这个基于 ASP 的应用程序发出新请求,并在查询字符串中嵌入用户 ID 和密码(当然是加密的).那么这个 ASP 应用程序将获取该信息并解密密码并执行自动登录?

For example is it possible that after a successful login in Joomla website, automatically issue a new request to this ASP based app with User ID and password ( encrypted of course ) embedded in query string. Then this ASP application would take that information and decrypt the password and perform auto login?

这是如何使用网络服务将 Joomla 登录会话从一个网站共享到另一个网站?一个 Joomla 网站的示例与另一个 Joomla 网站.

Here's How to use web services to share Joomla login session from one website to another? a example for one Joomla site with another Joomla site.

我希望看到解释解决方案的代码示例.

I hope to see code example for explain solution.

推荐答案

我对 ASP .NET MVC 不熟悉,但您可以参考 为 Joomla 创建插件.它可以是一个非常简单的用户插件,其中您将可以访问许多事件,特别是 OnUserLoginOnUserAfterLogin.您在这两个事件中放置的代码是您使用 CURL 或任何其他技术来发布您的 ASP 请求的地方.

I'm not familiar with ASP .NET MVC, but you can intercept the Joomla login event by referring to Creating a Plugin for Joomla. It can be a very simple User Plugin, with which you will have access to many events, particularly OnUserLogin and OnUserAfterLogin. The code you put in either of those two events is where you'd use CURL, or whatever other technology, to POST your ASP request.

非常基本的代码结构:

<?php 
defined('_JEXEC') or die; 
class Plgtest extends JPlugin {   
    public function onUserLogin($user, $options = array()) {
        // The user has now logged into Joomla - all user info is available in variable $user
        // Do some PHP stuff here to "issue a new request to this ASP based app"
        // Example PHP code for ASP login at https://stackoverflow.com/questions/25539787/how-to-post-asp-net-login-form-using-php-curl
    } 
} 
?>

参见这个问题用于从 PHP 登录到 ASP 的 PHP 代码.

See this question for the PHP code to login to ASP from PHP.

这篇关于如何将 Joomla 登录会话从一个 joomla 网站共享到一个 ASP.Net MVC 网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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