Red5安全教程 [英] Red5 Security Tutorial
问题描述
您可以使用安全框架为发布,回放或SharedObjects保护red5。在这种情况下,客户端并不重要,但是如果你想保护oflaDemo,你将需要在后端添加安全钩子。这里是你需要的教程:
http:// wiki.red5.org/wiki/Documentation/UsersReferenceManual/Red5CoreTechnologies/04-Security
更深入的安全教程在这里:
http://wiki.red5.org/wiki/Documentation/Tutorials/Red5AndAcegiSecurity
阻止播放的简单示例如下:
public class PlaybackSecurity实现IStreamPlaybackSecurity {
@Override
public boolean isPlaybackAllowed(IScope scope,String name,int start,int length,boolean flushPlaylist){
// start out denied
boolean allowed = false;
//获取当前连接
IConnection conn = Red5.getConnectionLocal();
//用于认证的令牌
长令牌= -1L;
if(conn.hasAttribute(token)){
//获取我们存储在其他连接上的'token'
token = conn.getLongAttribute(token);
//以某种方式验证标记
if(token> 0L){
allowed = true;
}
}
//返回允许或拒绝状态
返回允许;
应该在应用程序启动时添加安全类,所以我建议你把它在你的应用程序适配器的appStart方法中是这样的:
The security class should be added when your application starts, so I suggest that you put it in your application adapters "appStart" method like so:
@Override
public boolean appStart IScope app){
//注册我们的流安全类
registerStreamPlaybackSecurity(new PlaybackSecurity(applicationContext));
//将控制权交给super
返回super.appStart(app);
$ b $ CR $ CR $认证与Red5教程和来源: http://blog.infrared5.com/2012/05/red5-authentication/I am looking for a step by step tutorial on securing Red5 from intrusion. This seems to be a question that comes up alot in a google search, but is never really answered in a way that makes sense to your average flash developer.
解决方案You can secure red5 for Publishing, Playback, or SharedObjects using the security framework. The client does not matter in this case, but if you want to secure oflaDemo for instance you will need to add the security hooks on the backend. Here is the tutorial that you need: http://wiki.red5.org/wiki/Documentation/UsersReferenceManual/Red5CoreTechnologies/04-Security
A more in-depth security tutorial is here: http://wiki.red5.org/wiki/Documentation/Tutorials/Red5AndAcegiSecurity
A simple example to block playback is as follows:public class PlaybackSecurity implements IStreamPlaybackSecurity { @Override public boolean isPlaybackAllowed(IScope scope, String name, int start, int length, boolean flushPlaylist) { //start out denied boolean allowed = false; //get the current connection IConnection conn = Red5.getConnectionLocal(); //token to use for auth Long token = -1L; if (conn.hasAttribute("token")) { //get a 'token' we stored on their connection from elsewhere token = conn.getLongAttribute("token"); //validate the token in some way if (token > 0L) { allowed = true; } } //return allowed or denied state return allowed; } }
@Override public boolean appStart(final IScope app) { //register our stream security classes registerStreamPlaybackSecurity(new PlaybackSecurity(applicationContext)); //pass control back to super return super.appStart(app); }
CRAM authentication with Red5 tutorial and source: http://blog.infrared5.com/2012/05/red5-authentication/这篇关于Red5安全教程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!