Ejemplo n.º 1
0
        private void OnAuthenticateRequest(object sender, EventArgs e)
        {
            log.Debug("OnAuthenticateRequest");
            if (_checked && !_required)
            {
                return;
            }

            log.Debug("Taking application");
            var application = sender as HttpApplication;

            if (application == null)
            {
                return;
            }

            log.Debug("Taking context");
            var context = application.Context;

            if (context == null)
            {
                return;
            }

            log.Debug("Checking _checked");
            if (!_checked)
            {
                log.Debug("_checked=false");
                InitializeProvider();
                InitializeService();
                _required = _provider != null;
                _checked  = true;
            }

            log.Debug("Checking _required");
            if (!_required)
            {
                return;
            }

            log.Debug("Getting identity");
            var identity = _provider.RetrieveIdentity(context);

            log.Debug("identity is null: " + (identity == null));
            var eventArgs = new OAuthAuthenticationEventArgs(_provider, identity, context);

            log.Debug("Before OnAuthenticate");
            OnAuthenticate(eventArgs);
            log.Debug("After OnAuthenticate");
        }
Ejemplo n.º 2
0
        private void OnAuthenticateRequest(object sender, EventArgs e)
        {
            if (_checked && !_required)
            {
                return;
            }

            var application = sender as HttpApplication;

            if (application == null)
            {
                return;
            }

            var context = application.Context;

            if (context == null)
            {
                return;
            }

            if (!_checked)
            {
                InitializeProvider();
                InitializeService();
                _required = _provider != null;
                _checked  = true;
            }

            if (!_required)
            {
                return;
            }

            var identity  = _provider.RetrieveIdentity(context);
            var eventArgs = new OAuthAuthenticationEventArgs(_provider, identity, context);

            OnAuthenticate(eventArgs);
        }