/// <summary>
 /// Initializes a new instance of <see cref="WampMultiAuthenticationHost"/> given the
 /// <see cref="IWampSessionAuthenticatorFactory"/> to use.
 /// </summary>
 /// <param name="defaultAuthenticatorFactory">A default <see cref="IWampSessionAuthenticatorFactory"/> that will be used for the overload <see cref="RegisterTransport(IWampTransport,IEnumerable{WampSharp.V2.Binding.IWampBinding})"/></param>
 /// <param name="realmContainer">The <see cref="IWampRealmContainer"/> associated with this
 /// host.</param>
 /// <param name="uriValidator">The <see cref="IWampUriValidator"/> used to validate uris.</param>
 public WampMultiAuthenticationHost(IWampSessionAuthenticatorFactory defaultAuthenticatorFactory = null,
                                    IWampRealmContainer realmContainer = null,
                                    IWampUriValidator uriValidator     = null)
     : base(realmContainer, uriValidator)
 {
     mDefaultAuthenticatorFactory = defaultAuthenticatorFactory;
 }
Esempio n. 2
0
 public WampAuthenticationBinaryBinding(IWampBinaryBinding <TMessage> binding,
                                        IWampSessionAuthenticatorFactory sessionAuthenticationFactory,
                                        IWampUriValidator uriValidator)
     : base(binding, sessionAuthenticationFactory, uriValidator)
 {
     mBinding = binding;
 }
 public static void ValidateSessionAuthenticatorFactoryWasProvided(IWampSessionAuthenticatorFactory authenticatorFactory, IWampBinding binding)
 {
     if (authenticatorFactory == null)
     {
         throw new
               ArgumentException($"No IWampSessionAuthenticatorFactory was provided for the binding named '{binding.Name}'.");
     }
 }
Esempio n. 4
0
 /// <summary>
 /// Initializes a new instance of <see cref="DefaultWampAuthenticationHost"/> listening at
 /// the given location with the given bindings and the given
 /// <see cref="IWampRealmContainer"/>.
 /// </summary>
 /// <param name="location">The given location.</param>
 /// <param name="sessionAuthenticationFactory">The <see cref="IWampSessionAuthenticatorFactory"/>
 /// used to accept pending clients.</param>
 public DefaultWampAuthenticationHost
     (string location,
     IWampSessionAuthenticatorFactory sessionAuthenticationFactory)
     : this(location : location,
            sessionAuthenticationFactory : sessionAuthenticationFactory,
            cookieAuthenticatorFactory : null,
            certificate : null)
 {
 }
 public WampAuthenticationSessionServer(IWampBinding <TMessage> binding,
                                        IWampHostedRealmContainer realmContainer,
                                        IWampRouterBuilder builder,
                                        IWampEventSerializer eventSerializer,
                                        IWampSessionAuthenticatorFactory sessionAuthenticatorFactory)
     : base(binding, realmContainer, builder, eventSerializer)
 {
     mSessionAuthenticatorFactory = sessionAuthenticatorFactory;
 }
        protected WampAuthenticationBinding(IWampBinding <TMessage> binding,
                                            IWampSessionAuthenticatorFactory sessionAuthenticationFactory,
                                            IWampUriValidator uriValidator)
        {
            mBinding      = binding;
            mUriValidator = uriValidator;

            mSessionAuthenticationFactory =
                new RestrictedSessionAuthenticationFactory(sessionAuthenticationFactory);
        }
Esempio n. 7
0
        /// <summary>
        /// Initializes a new instance of <see cref="WampAuthenticationHost"/> given the
        /// <see cref="IWampSessionAuthenticatorFactory"/> to use.
        /// </summary>
        /// <param name="sessionAuthenticationFactory">The <see cref="IWampSessionAuthenticatorFactory"/>
        /// used to accept pending clients.</param>
        /// <param name="realmContainer">The <see cref="IWampRealmContainer"/> associated with this
        /// host.</param>
        /// <param name="uriValidator">The <see cref="IWampUriValidator"/> used to validate uris.</param>
        public WampAuthenticationHost(IWampSessionAuthenticatorFactory sessionAuthenticationFactory,
                                      IWampRealmContainer realmContainer = null,
                                      IWampUriValidator uriValidator     = null)
            : base(realmContainer, uriValidator)
        {
            if (sessionAuthenticationFactory == null)
            {
                throw new ArgumentNullException("sessionAuthenticationFactory");
            }

            mSessionAuthenticationFactory = sessionAuthenticationFactory;
        }
Esempio n. 8
0
 /// <summary>
 /// Initializes a new instance of <see cref="DefaultWampHost"/> listening at
 /// the given location with the given bindings and the given
 /// <see cref="IWampRealmContainer"/>.
 /// </summary>
 /// <param name="location">The given location.</param>
 /// <param name="sessionAuthenticationFactory">The <see cref="IWampSessionAuthenticatorFactory"/>
 /// used to accept pending clients.</param>
 /// <param name="cookieAuthenticatorFactory">The given <see cref="ICookieAuthenticatorFactory"/> used to authenticate
 /// users given their cookies.</param>
 /// <param name="certificate">The <see cref="X509Certificate2"/> certificate to use for secured websockets.</param>
 public DefaultWampAuthenticationHost
     (string location,
     IWampSessionAuthenticatorFactory sessionAuthenticationFactory,
     ICookieAuthenticatorFactory cookieAuthenticatorFactory = null,
     X509Certificate2 certificate = null)
     : this(location : location,
            sessionAuthenticationFactory : sessionAuthenticationFactory,
            bindings : null,
            cookieAuthenticatorFactory : cookieAuthenticatorFactory,
            certificate : certificate)
 {
 }
Esempio n. 9
0
 /// <summary>
 /// Initializes a new instance of <see cref="DefaultWampHost"/> listening at
 /// the given location with the given bindings and the given
 /// <see cref="IWampRealmContainer"/>.
 /// </summary>
 /// <param name="location">The given location.</param>
 /// <param name="sessionAuthenticationFactory"></param>
 /// <param name="bindings">The given bindings.</param>
 /// <param name="cookieAuthenticatorFactory"></param>
 /// <param name="certificate"></param>
 public DefaultWampAuthenticationHost
     (string location,
     IWampSessionAuthenticatorFactory sessionAuthenticationFactory,
     IEnumerable <IWampBinding> bindings = null,
     ICookieAuthenticatorFactory cookieAuthenticatorFactory = null,
     X509Certificate2 certificate = null)
     : this(location : location,
            sessionAuthenticationFactory : sessionAuthenticationFactory,
            realmContainer : null,
            uriValidator : null,
            bindings : bindings,
            cookieAuthenticatorFactory : cookieAuthenticatorFactory, certificate : certificate)
 {
 }
Esempio n. 10
0
        /// <summary>
        /// Initializes a new instance of <see cref="DefaultWampHost"/> listening at
        /// the given location with the given bindings and the given
        /// <see cref="IWampRealmContainer"/>.
        /// </summary>
        /// <param name="location">The given location.</param>
        /// <param name="sessionAuthenticationFactory">The <see cref="IWampSessionAuthenticatorFactory"/>
        /// used to accept pending clients.</param>
        /// <param name="realmContainer">The <see cref="IWampRealmContainer"/> associated with this
        /// host.</param>
        /// <param name="uriValidator">The <see cref="IWampUriValidator"/> used to validate uris.</param>
        /// <param name="bindings">The given bindings.</param>
        /// <param name="cookieAuthenticatorFactory">The given <see cref="ICookieAuthenticatorFactory"/> used to authenticate
        /// users given their cookies.</param>
        /// <param name="certificate">The <see cref="X509Certificate2"/> certificate to use for secured websockets.</param>
        public DefaultWampAuthenticationHost(string location,
                                             IWampSessionAuthenticatorFactory sessionAuthenticationFactory,
                                             IWampRealmContainer realmContainer  = null,
                                             IWampUriValidator uriValidator      = null,
                                             IEnumerable <IWampBinding> bindings = null,
                                             ICookieAuthenticatorFactory cookieAuthenticatorFactory = null,
                                             X509Certificate2 certificate = null)
            : base(sessionAuthenticationFactory, realmContainer, uriValidator)
        {
            bindings = bindings ?? new IWampBinding[] { new JTokenJsonBinding(), new JTokenMsgpackBinding() };

            this.RegisterTransport(
                new FleckAuthenticatedWebSocketTransport(location, cookieAuthenticatorFactory, certificate),
                bindings.ToArray());
        }
Esempio n. 11
0
 public WampAuthenticationRouterBuilder(IWampSessionAuthenticatorFactory sessionAuthenticationFactory,
                                        IWampUriValidator uriValidator) :
     base(uriValidator)
 {
     mSessionAuthenticationFactory = sessionAuthenticationFactory;
 }
 /// <summary>
 /// Fallback in case that binding doesn't implement
 /// IWampBinding{TMessage}
 /// </summary>
 /// <param name="binding"></param>
 /// <param name="authenticatorFactory"></param>
 /// <returns></returns>
 private IWampBinding CreateAuthenticationBinding(IWampBinding binding, IWampSessionAuthenticatorFactory authenticatorFactory)
 {
     return(null);
 }
 private IWampBinding CreateAuthenticationBinding <TMessage>
     (IWampBinding <TMessage> binding, IWampSessionAuthenticatorFactory authenticatorFactory)
 {
     ThrowHelper.ValidateSessionAuthenticatorFactoryWasProvided(authenticatorFactory, binding);
     return(new WampAuthenticationBinding <TMessage>(binding, authenticatorFactory, this.UriValidator));
 }
Esempio n. 14
0
 public RestrictedSessionAuthenticationFactory(IWampSessionAuthenticatorFactory sessionAuthenticationFactory)
 {
     mSessionAuthenticationFactory = sessionAuthenticationFactory;
 }
 public WampAuthenticationPlayground(IWampSessionAuthenticatorFactory sessionAuthenticationFactory) :
     base(new JTokenJsonBinding(), sessionAuthenticationFactory)
 {
 }