Exemplo n.º 1
0
        public override void OnAuthenticated(string authKey, WampCraPermissions permissions)
        {
            // In the real world, You'd want to possibly base this set of permissions on the
            // user defined in authKey

            if (string.Equals(authKey, "foobar", StringComparison.Ordinal))
            {
                // For the sample, set the permissions for 'foobar' to allow all currently available RPC methods.
                foreach (IWampRpcMethod rpcMethod in this.GetAllRpcMethods())
                {
                    // You can do some logic here to determine if this client has permissions or not, like finding some attribute
                    // with an auth level and checking that against the client's auth key.
                    permissions.rpc.Add(new WampRpcPermissions(rpcMethod.ProcUri, true));
                }

                permissions.pubsub.Add(new WampPubSubPermissions("http://example.com/topics/", true, true, true));

                //Could also do something like this:
                //foreach (var topic in this.GetTopicContainer().Topics)
                //    permissions.pubsub.Add(new WampPubSubPermissions(topic.TopicUri, false, false, true));
            }
            else
            {
                //An anonymous user will only get this permission (no rpc)
                permissions.pubsub.Add(new WampPubSubPermissions("http://example.com/topics/mytopic1", false, false, true));
            }
        }
Exemplo n.º 2
0
 public WampCraPendingAuth(WampCraChallenge authInfo, string signature, WampCraPermissions permissions)
 {
     AuthInfo    = authInfo;
     Signature   = signature;
     Permissions = permissions;
 }
Exemplo n.º 3
0
 public WampCraPendingAuth(WampCraChallenge authInfo, string signature, WampCraPermissions permissions)
 {
     AuthInfo = authInfo;
     Signature = signature;
     Permissions = permissions;
 }