コード例 #1
0
        //adding new GetUserInfo method for IAuthenticationExtension2
        public void GetUserInfo(IRSRequestContext requestContext, out IIdentity userIdentity, out IntPtr userId)
        {
            userIdentity = null;

            if (requestContext.User != null)
            {
                userIdentity = requestContext.User;
            }
            userId = IntPtr.Zero;
        }
コード例 #2
0
        //adding new GetUserInfo method for IAuthenticationExtension2
        public void GetUserInfo(IRSRequestContext requestContext, out IIdentity userIdentity, out IntPtr userId)
        {
            userIdentity = null;
            if (requestContext.User != null)
            {
                userIdentity = requestContext.User;
            }

            // initialize a pointer to the current user id to zero
            userId = IntPtr.Zero;
        }
        public void GetUserInfo(IRSRequestContext requestContext, out System.Security.Principal.IIdentity userIdentity, out IntPtr userId)
        {
            //throw new NotImplementedException();

            userIdentity = null;
            if (requestContext.User != null)
            {
                userIdentity = requestContext.User;
            }



            // initialize a pointer to the current user id to zero
            userId = IntPtr.Zero;
        }
コード例 #4
0
 public void GetUserInfo(IRSRequestContext requestContext, out IIdentity userIdentity, out IntPtr userId)
 {
     userIdentity = null;
     if (requestContext.User != null)
     {
         // This is the custom bit - Create a Custom PE Identity
         var handle = GetIdentityHandle(requestContext.User.Name);
         userIdentity = (ClaimsIdentity)handle.Target;
         userId       = GCHandle.ToIntPtr(handle);
     }
     else
     {
         // No Anonymous Access
         userIdentity = null;
         userId       = IntPtr.Zero;
     }
 }
        public virtual void GetUserInfo(IRSRequestContext requestContext, out IIdentity userIdentity, out IntPtr userId)
        {
            userId       = IntPtr.Zero;
            userIdentity = requestContext.User;

            var cookies = requestContext.Cookies ?? new Dictionary <string, string>();

            this.LogDebugIfEnabled(string.Format(CultureInfo.InvariantCulture, "User-identity = {0}, cookies = {1}.", userIdentity == null ? "NULL" : (userIdentity.IsAuthenticated ? userIdentity.Name : "Anonymous"), string.Join(", ", cookies.Keys)), "GetUserInfo (3 parameters)");

            if (userIdentity == null)
            {
                try
                {
                    userIdentity = this.IdentityResolver.GetIdentity(cookies);
                }
                catch (Exception exception)
                {
                    const string message = "Could not get identity from cookies.";
                    const string method  = "GetUserInfo (3 parameters)";

                    this.LogErrorIfEnabled(exception, message, method);

                    throw new InvalidOperationException("WindowsAuthentication - " + method + ": " + message, exception);
                }
            }

            if (userIdentity == null)
            {
                return;
            }

            if (!(userIdentity is IWindowsFederationIdentity))
            {
                this.ThrowIdentityMustBeAWindowsFederationIdentityException("GetUserInfo (3 parameters)", "request-context-user");
            }
        }