[转载]FMS Dev Guide学习笔记(验证用户)

本文详细介绍了如何在媒体应用程序中实现用户身份验证,并通过外部资源进行连接管理。包括使用Actionscript提供用户名和密码,以及通过第三方系统验证。还涉及了FlashMediaServer在请求连接时的身份验证流程,以及接受或禁止连接的方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

一、开发交互式的媒体应用程序

1.使用外部资源验证用户

    对于有限数量的客户,请求用户名密码,然后通过外部资源(像数据库、LDAP服务或其它访问授权服务)验证它们,是可行的.

    a.SWF在请求连接的时候提供用户名和密码

    通过客户端Actionscript,客户端提供token或者用户名和密码:

var sUsername = "someUsername";
var sPassword = "somePassword";

nc.connect("rtmp://server/secure1/", sUsername, sPassword);

    b.FlashMediaServer通过第三方系统验证用户名和密码

你可以使用如下类来从服务端Actionscript访问外部资源:WebService、LoadVar、XML classes、NetServices(Flash Remoting).参见Server-Side ActionScript Language Reference以获取更多关于这些类的信息.关于FlashRemoting请参见http://www.adobe.com/go/learn_fms_flashremoting_en.

load("NetServices.asc");     // for Flash remoting
load("WebServices.asc");     // for SOAP web services

pendingConnections = new Object();

application.onConnect = function( pClient, pUsername, pPassword ) {

    // create a unique ID for the client
    pClient.FMSid = application.FMSid++;

    // place the client into a pending array
    pendingConnections[FMSid] = pClient;

    if (pUsername!= undefined && pPassword !=undefined) {
        // issue the external call (3 examples below)
        loadVars.send("http://xyz.com/auth.cfm");

        webService.authenticate(FMSid, pUsername, pPassword);

        netService.authenticate(FMSid, pUsername, pPassword);
    }

// the result handler (sample only, you will have to customize this)
// this command will return a true/false and the FMS client id
Authenticate.onResult = { }

    c.FlashMediaServer接受或者禁止这个连接

    loadVars.onData = function ( FMSid, pData ) {
    if (pData) {
        application.acceptConnection( pendingConnections[FMSid] );
        delete pendingConnections[FMSid];
    } else {
        application. rejectConnection ( pendingConnections[FMSid] );
    delete pendingConnections[FMSid];
    }
}

转载于:https://www.cnblogs.com/chenhaib/p/3469603.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值