Exemplo n.º 1
0
        /// <summary>
        /// The specified <paramref name="session"/> may change as a side-effect of this method. If
        /// subsequent code relies on current <see cref="IAuthSession"/> data be sure to reload
        /// the session istance via <see cref="ServiceExtensions.GetSession(IServiceBase,bool)"/>.
        /// </summary>
        private object Authenticate(Authenticate request, string provider, IAuthSession session, IAuthProvider oAuthConfig)
        {
            if (request.provider == null && request.UserName == null)
            {
                return(null); //Just return sessionInfo if no provider or username is given
            }
            var authFeature        = HostContext.GetPlugin <AuthFeature>();
            var generateNewCookies = authFeature == null || authFeature.GenerateNewSessionCookiesOnAuthentication;

            object response = null;

            if (!oAuthConfig.IsAuthorized(session, session.GetOAuthTokens(provider), request))
            {
                if (generateNewCookies)
                {
                    this.Request.GenerateNewSessionCookies(session);
                }

                response = oAuthConfig.Authenticate(this, session, request);
            }
            else
            {
                if (generateNewCookies)
                {
                    this.Request.GenerateNewSessionCookies(session);
                    this.Request.SaveSession(session);
                }
            }
            return(response);
        }
Exemplo n.º 2
0
        /// <summary>
        /// The specified <paramref name="session"/> may change as a side-effect of this method. If
        /// subsequent code relies on current <see cref="IAuthSession"/> data be sure to reload
        /// the session istance via <see cref="ServiceExtensions.GetSession(SStack.ServiceInterface.IServiceBase,bool)"/>.
        /// </summary>
        private object Authenticate(Auth request, string provider, IAuthSession session, IAuthProvider oAuthConfig)
        {
            object response = null;

            if (!oAuthConfig.IsAuthorized(session, session.GetOAuthTokens(provider), request))
            {
                response = oAuthConfig.Authenticate(this, session, request);
            }
            return(response);
        }
Exemplo n.º 3
0
        /// <summary>
        /// The specified <paramref name="session"/> may change as a side-effect of this method. If
        /// subsequent code relies on current <see cref="IAuthSession"/> data be sure to reload
        /// the session istance via <see cref="ServiceExtensions.GetSession(IServiceBase,bool)"/>.
        /// </summary>
        private object Authenticate(Authenticate request, string provider, IAuthSession session, IAuthProvider oAuthConfig)
        {
            if (request.provider == null && request.UserName == null)
            {
                return(null); //Just return sessionInfo if no provider or username is given
            }
            object response = null;

            if (!oAuthConfig.IsAuthorized(session, session.GetOAuthTokens(provider), request))
            {
                response = oAuthConfig.Authenticate(this, session, request);
            }
            return(response);
        }
Exemplo n.º 4
0
 /// <summary>
 /// The specified <paramref name="session"/> may change as a side-effect of this method. If
 /// subsequent code relies on current <see cref="IAuthSession"/> data be sure to reload
 /// the session istance via <see cref="ServiceExtensions.GetSession(IServiceBase,bool)"/>.
 /// </summary>
 private object Authenticate(Authenticate request, string provider, IAuthSession session, IAuthProvider oAuthConfig)
 {
     object response = null;
     if (!oAuthConfig.IsAuthorized(session, session.GetOAuthTokens(provider), request))
     {
         response = oAuthConfig.Authenticate(this, session, request);
     }
     return response;
 }
        /// <summary>
        /// The specified <paramref name="session"/> may change as a side-effect of this method. If
        /// subsequent code relies on current <see cref="IAuthSession"/> data be sure to reload
        /// the session istance via <see cref="ServiceExtensions.GetSession(IServiceBase,bool)"/>.
        /// </summary>
        private object Authenticate(Authenticate request, string provider, IAuthSession session, IAuthProvider oAuthConfig)
        {
            if (request.provider == null && request.UserName == null)
                return null; //Just return sessionInfo if no provider or username is given

            object response = null;
            if (!oAuthConfig.IsAuthorized(session, session.GetOAuthTokens(provider), request))
            {
                response = oAuthConfig.Authenticate(this, session, request);
            }
            return response;
        }
        /// <summary>
        /// The specified <paramref name="session"/> may change as a side-effect of this method. If
        /// subsequent code relies on current <see cref="IAuthSession"/> data be sure to reload
        /// the session istance via <see cref="ServiceExtensions.GetSession(IServiceBase,bool)"/>.
        /// </summary>
        private object Authenticate(Authenticate request, string provider, IAuthSession session, IAuthProvider oAuthConfig)
        {
            if (request.provider == null && request.UserName == null)
                return null; //Just return sessionInfo if no provider or username is given

            var authFeature = HostContext.GetPlugin<AuthFeature>();
            var generateNewCookies = authFeature == null || authFeature.GenerateNewSessionCookiesOnAuthentication;

            object response = null;
            if (!oAuthConfig.IsAuthorized(session, session.GetOAuthTokens(provider), request))
            {
                if (generateNewCookies)
                    this.Request.GenerateNewSessionCookies(session);

                response = oAuthConfig.Authenticate(this, session, request);
            }
            else
            {
                if (generateNewCookies)
                {
                    this.Request.GenerateNewSessionCookies(session);
                    this.Request.SaveSession(session);
                }
            }
            return response;
        }