public UserInfo ValidateIzendaAuthToken(string access_token)
        {
            var userInfo = IzendaTokenAuthorization.GetUserInfo(access_token);

            Console.WriteLine(userInfo);

            return(userInfo);
        }
 public UserInfo ValidateIzendaAuthToken(string access_token)
 {
     try
     {
         UserInfo userInfo = IzendaTokenAuthorization.GetUserInfo(access_token);
         return(userInfo);
     }
     catch {
         return(null);
     }
 }
        public ActionResult ReportPart(Guid id, string token)
        {
            //can we validate the token here
            //validates token
            var user = IzendaTokenAuthorization.GetUserInfo(token);

            if (user != null)
            {
                ViewBag.Id    = id;
                ViewBag.Token = token;
            }
            else
            {
                return(HttpNotFound());                // is invalid user roles
            }


            return(View());
        }
Пример #4
0
        public static void RegisterLoginLogic()
        {
            //This is used for exporting only
            UserIntegrationConfig.GetAccessToken = (args) =>
            {
                return(IzendaTokenAuthorization.GetToken(new UserInfo()
                {
                    UserName = args.UserName,
                    TenantUniqueName = args.TenantId
                }));
            };

            UserIntegrationConfig.ValidateToken = (ValidateTokenArgs args) =>
            {
                var token = args.AccessToken;
                var user  = IzendaTokenAuthorization.GetUserInfo(token);

                // TenantUniqueName corresponds to the 'TenantID' field in the IzendaTenant table
                return(new ValidateTokenResult {
                    UserName = user.UserName, TenantUniqueName = user.TenantUniqueName
                });
            };
        }