コード例 #1
0
        private (string Name, string EmailAddress) GetTarget(UserSelectedContext userContext, UserProfile user, Audience audience)
        {
            (string Name, string EmailAddress)target;

            switch (audience)
            {
            case Audience.Support:
                target = (audience.ToString(), "*****@*****.**");
                break;

            case Audience.BranchSupport:
                var branch = GetBranch(userContext);
                target = (branch.BranchName, branch.Email);
                break;

            case Audience.SalesRep:
                var customer = GetCustomer(userContext, user);
                target = (customer.Dsr.Name, customer.Dsr.EmailAddress);
                break;

            case Audience.User:
                target = (user.Name, user.EmailAddress);
                break;

            default:
                target = (audience.ToString(), "*****@*****.**");
                break;
            }

            // Route feedback to originating user when not in production
            if (Common.Impl.Configuration.IsProduction == false)
            {
                target = ("non-production user", AuthenticatedUser.EmailAddress);
            }

            return(target);
        }
コード例 #2
0
        internal object ToJavaScriptObject()
        {
            var now = DateTime.UtcNow;

            var claimSet = new
            {
                iss   = Issuer,
                scope = string.Join(" ", Scopes),
                aud   = (Audience == null) ? null : Audience.ToString(),
                iat   = (Convert.ToInt64(now.Subtract(UnixEpoch).TotalSeconds)),
                exp   = (Convert.ToInt64(now.Add(Duration).Subtract(UnixEpoch).TotalSeconds))
            };

            return(claimSet);
        }