Red5 を侵入から保護するための段階的なチュートリアルを探しています。これは、Google 検索でよく出てくる質問のようですが、平均的なフラッシュ開発者にとって意味のある方法で実際に答えられることは決してありません。
2 に答える
セキュリティ フレームワークを使用して、公開、再生、または共有オブジェクトに対して red5 を保護できます。この場合、クライアントは問題ではありませんが、たとえば oflaDemo を保護したい場合は、バックエンドにセキュリティ フックを追加する必要があります。必要なチュートリアルは次のとおりです:
http://wiki.red5.org/wiki/Documentation/UsersReferenceManual/Red5CoreTechnologies/04-Security
より詳細なセキュリティ チュートリアルは次のとおりです:
http://wiki.red5.org/wiki /Documentation/Tutorials/Red5AndAcegiSecurity
再生をブロックする簡単な例は次のとおりです。
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;
}
}
セキュリティ クラスはアプリケーションの起動時に追加する必要があるため、次のようにアプリケーション アダプタの「appStart」メソッドに追加することをお勧めします:
@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);
}
Red5 を使用した CRAM 認証のチュートリアルとソース: http://blog.infrared5.com/2012/05 /red5-認証/
クライアント側からバックエンドを保護することはできません。OflaDemoはデモアプリであり、本番アプリではありません。デフォルトでは、Red5はグローバル接続を許可しないため、独自のアプリケーションのみを実行する場合は、任意の種類のセキュリティを実装できます。
いいえ、ファイアウォールレベルでのみセキュリティを管理しようとすることは実際には必要ありません(そして有用ではありません)。APIは、red5のさまざまな使用法へのユーザーアクセスを制限することを許可します。