예제 #1
0
        public void Configure(ConfigSource config)
        {
            consumerRequests = config.GetBoolean("consumerRequests");

            ConfigSource child = config.GetChild("accessVerifier");
            if (child != null) {
                string typeString = child.GetString("type");
                if (String.IsNullOrEmpty(typeString))
                    throw new ConfigurationException("The 'accessVerifier' type was not specified.", child, "type");

                Type type = Type.GetType(typeString, false, true);
                if (type == null)
                    throw new ConfigurationException("The type '" + typeString + "' could not be found.", child, "type");

                if (!typeof (IPathAccessVerifier).IsAssignableFrom(type))
                    throw new ConfigurationException(
                        "The type '" + type + "' cannot be is not an implementation of '" + typeof (IPathAccessVerifier) + "'.", child,
                        "type");

                try {
                    accessVerifier = (IPathAccessVerifier) Activator.CreateInstance(type);
                    accessVerifier.Context = OAuthProvider.Current;
                    accessVerifier.Configure(child);
                } catch (ConfigurationException) {
                    throw;
                } catch (Exception e) {
                    throw new ConfigurationException("Error while initializing the type '" + type + "': " + e.Message, e);
                }
            }
        }
예제 #2
0
        protected virtual void Configure(ConfigSource config)
        {
            tokenStore             = (ITokenStore)ConfigureComponent(config.GetChild("tokenStore"), typeof(ITokenStore), typeof(HeapTokenStore));
            callbackStore          = (ICallbackStore)ConfigureComponent(config.GetChild("callbackStore"), typeof(ICallbackStore), typeof(HeapCallbackStore));
            consumerStore          = (IConsumerStore)ConfigureComponent(config.GetChild("consumerStore"), typeof(IConsumerStore), typeof(HeapConsumerStore));
            requestIdValidator     = (IRequestIdValidator)ConfigureComponent(config.GetChild("requestIdValidator"), typeof(IRequestIdValidator), typeof(HeapRequestIdValidator));
            resourceAccessVerifier = (IResourceAccessVerifier)ConfigureComponent(config.GetChild("resourceAccessVerifier"), typeof(IResourceAccessVerifier), null);
            tokenGenerator         = (ITokenGenerator)ConfigureComponent(config.GetChild("tokenGenerator"), typeof(ITokenGenerator), typeof(GuidTokenGenerator));
            verificationProvider   = (IVerificationProvider)ConfigureComponent(config.GetChild("verificationProvider"), typeof(IVerificationProvider), typeof(MD5HashVerificationProvider));

            allowOutOfBandCallback = config.GetBoolean("oobCallback");
        }
예제 #3
0
        public void Configure(ConfigSource config)
        {
            consumerRequests = config.GetBoolean("consumerRequests");

            ConfigSource child = config.GetChild("accessVerifier");

            if (child != null)
            {
                string typeString = child.GetString("type");
                if (String.IsNullOrEmpty(typeString))
                {
                    throw new ConfigurationException("The 'accessVerifier' type was not specified.", child, "type");
                }

                Type type = Type.GetType(typeString, false, true);
                if (type == null)
                {
                    throw new ConfigurationException("The type '" + typeString + "' could not be found.", child, "type");
                }

                if (!typeof(IPathAccessVerifier).IsAssignableFrom(type))
                {
                    throw new ConfigurationException(
                              "The type '" + type + "' cannot be is not an implementation of '" + typeof(IPathAccessVerifier) + "'.", child,
                              "type");
                }

                try {
                    accessVerifier         = (IPathAccessVerifier)Activator.CreateInstance(type);
                    accessVerifier.Context = OAuthProvider.Current;
                    accessVerifier.Configure(child);
                } catch (ConfigurationException) {
                    throw;
                } catch (Exception e) {
                    throw new ConfigurationException("Error while initializing the type '" + type + "': " + e.Message, e);
                }
            }
        }
예제 #4
0
        protected virtual void Configure(ConfigSource config)
        {
            tokenStore = (ITokenStore)ConfigureComponent(config.GetChild("tokenStore"), typeof(ITokenStore), typeof(HeapTokenStore));
            callbackStore = (ICallbackStore)ConfigureComponent(config.GetChild("callbackStore"), typeof(ICallbackStore), typeof(HeapCallbackStore));
            consumerStore = (IConsumerStore)ConfigureComponent(config.GetChild("consumerStore"), typeof(IConsumerStore), typeof(HeapConsumerStore));
            requestIdValidator = (IRequestIdValidator)ConfigureComponent(config.GetChild("requestIdValidator"), typeof(IRequestIdValidator), typeof(HeapRequestIdValidator));
            resourceAccessVerifier = (IResourceAccessVerifier)ConfigureComponent(config.GetChild("resourceAccessVerifier"), typeof(IResourceAccessVerifier), null);
            tokenGenerator = (ITokenGenerator)ConfigureComponent(config.GetChild("tokenGenerator"), typeof(ITokenGenerator), typeof(GuidTokenGenerator));
            verificationProvider = (IVerificationProvider)ConfigureComponent(config.GetChild("verificationProvider"), typeof(IVerificationProvider), typeof(MD5HashVerificationProvider));

            allowOutOfBandCallback = config.GetBoolean("oobCallback");
        }