예제 #1
0
        // Raised when the authorization process finishes with a result in e.Param.IsAuthorized [true|false]
        void handler_AuthorizeRequestFinished(object sender, Eventing.Args.AuthorizeRequestEventArgs e)
        {
            // Demo 3: Deny authorization with e.Param.IsAuthorized
            // if (e.Param.CurrentUserRoles.Count == 0) e.Param.IsAuthorized = false;

            e.Context.PipelineControl.Message.MessageText += string.Format(_logpattern, "log-auth", "AuthorizeRequestFinished", DateTime.Now.ToLongTimeString());
        }
예제 #2
0
        // Raised when the authorization process starts
        void handler_AuthorizeRequestStarted(object sender, Eventing.Args.AuthorizeRequestEventArgs e)
        {
            // Demo 2a: Force authorization of anonymous users:
            // e.Param.AllowAnonymous = true;

            // Demo 2b: Force authorization with roles:
            // e.Param.AllowAnonymous = false;
            // e.Param.IsAuthenticated = true;
            // e.Param.AllowedRoles.Add("SomeRole");
            // e.Param.CurrentUserRoles.Add("SomeRole");

            e.Context.PipelineControl.Message.MessageText += string.Format(_logpattern, "log-auth", "AuthorizeRequestStarted", DateTime.Now.ToLongTimeString());
        }