Example #1
0
        public OAuth1App(
            string consumerKey,
            string consumerSecret,
            string callbackUrl,
#if __WINDOWS__
            AuthenticationInterfaceEnum browserType = AuthenticationInterfaceEnum.Dedicated,
            OAuthAppTypeEnum appType = OAuthAppTypeEnum.Desktop
Example #2
0
        public virtual OAuth2ResourceProvider SetFlow(
            string clientId,
            string clientSecret,
            AuthenticationInterfaceEnum @interface,
            OAuthAppTypeEnum appType)
        {
            ResponseTypeEnum flow;

            if (@interface == AuthenticationInterfaceEnum.Dedicated &&
                appType == OAuthAppTypeEnum.Desktop)
            {
                flow = clientSecret != null ?
                       ResponseTypeEnum.Code :
                       ResponseTypeEnum.Token;
            }
            else if (@interface == AuthenticationInterfaceEnum.Embedded &&
                     appType == OAuthAppTypeEnum.Desktop)
            {
                throw new NotSupportedException(
                          StringResources.EmbeddedDesktopUINotSupportedException);
            }
            else if (@interface == AuthenticationInterfaceEnum.Dedicated &&
                     appType == OAuthAppTypeEnum.Mobile)
            {
                flow = ResponseTypeEnum.Code;
            }
            else if (@interface == AuthenticationInterfaceEnum.Embedded &&
                     appType == OAuthAppTypeEnum.Mobile)
            {
                flow = clientSecret != null ?
                       ResponseTypeEnum.Code :
                       ResponseTypeEnum.Token;
            }
            else
            {
                throw new NotSupportedException();
            }

            if (!Flows.Contains(flow))
            {
                throw new InvalidGrantTypeException(
                          string.Format(
                              StringResources.GrantTypeNotSupportedException,
                              GetType().Name));
            }

            Flow = flow;

            return(this);
        }
Example #3
0
 public OAuth1AppBase(
     string consumerKey,
     string consumerSecret,
     string callbackUrl,
     IOAuthAuthorizerUIFactory uiFactory,
     TResourceProvider provider,
     AuthenticationInterfaceEnum browserType,
     OAuthAppTypeEnum appType)
 {
     _consumerKey    = consumerKey;
     _consumerSecret = consumerSecret;
     _callbackUrl    = callbackUrl;
     _uiFactory      = uiFactory;
     _provider       = provider;
     _browserType    = browserType;
     _appType        = appType;
 }
Example #4
0
 public OAuth2AppBase(
     string clientId,
     string callbackUrl,
     IOAuthAuthorizerUIFactory uiFactory,
     TResourceProvider provider,
     AuthenticationInterfaceEnum browserType,
     OAuthAppTypeEnum appType) :
     this(
         clientId,
         null,
         callbackUrl,
         uiFactory,
         provider,
         browserType,
         appType)
 {
 }
Example #5
0
        public OAuth2AppBase(
            string clientId,
            string clientSecret,
            string callbackUrl,
            IOAuthAuthorizerUIFactory uiFactory,
            TResourceProvider provider,
            AuthenticationInterfaceEnum browserType,
            OAuthAppTypeEnum appType)
        {
            _clientId     = clientId;
            _clientSecret = clientSecret;
            _callbackUrl  = callbackUrl;
            _browserType  = browserType;
            _uiFactory    = uiFactory;
            _provider     = provider;

            provider.SetFlow(
                clientId,
                clientSecret,
                browserType,
                appType);
        }