public static dynamic VerifyUserSMS(SMSViewModel model)
        {
            var oCode = new SendSMSPassCode();

            oCode.PassCode = model.PassCode;

            var sJsonResponse = JsonHelper.Post(model.ApiUrl, JsonHelper.JsonContent(oCode), _oktaToken);

            return(JsonConvert.DeserializeObject(sJsonResponse));
        }
Exemple #2
0
        public static OktaSessionResponse SendBasicLogin(LoginViewModel login)
        {
            //create simple class to lowecase & minimize model for json - case sensitive
            var ologin = new Login
            {
                username = login.UserName,
                password = login.Password
            };

            var sJsonResponse = JsonHelper.Post($"https://{_apiUrlBase}/api/v1/authn", JsonHelper.JsonContent(ologin));

            return(JsonConvert.DeserializeObject <OktaSessionResponse>(sJsonResponse));
        }
Exemple #3
0
        public static dynamic AddNewCustomer(Customer oCustomer)
        {
            var oNewCustomer  = new CustomerAdd(oCustomer);
            var sJsonResponse = JsonHelper.Post($"https://{_apiUrlBase}/api/v1/users?activate=true", JsonHelper.JsonContent(oNewCustomer), _oktaToken);

            return(JsonConvert.DeserializeObject(sJsonResponse));
        }
Exemple #4
0
        public static dynamic UpdateCustomer(Customer oCustomer)
        {
            var uc            = new CustomerUpdate(oCustomer);
            var sJsonResponse = JsonHelper.Post($"https://{_apiUrlBase}/api/v1/users/{oCustomer.Id}", JsonHelper.JsonContent(uc), _oktaToken);

            return(JsonConvert.DeserializeObject(sJsonResponse));
        }
Exemple #5
0
        public static dynamic AddNewCustomer(Customer oCustomer)
        {
            var oNewCustomer = new CustomerAdd(oCustomer);

            return(JsonHelper.Post($"https://{_apiUrlBase}/api/v1/users?activate=true", JsonHelper.JsonContent(oNewCustomer), _oktaToken));;
        }
        public static dynamic AddNewUser(LoginViewModel model)
        {
            var oProfile = new Profile
            {
                Email     = model.UserName,
                Login     = model.UserName,
                FirstName = "No",
                LastName  = "Name"
                            //First & Last name is currently required, either pass them in or set fake name
                            //Okta is removing this requirement soon and it won't required
            };
            var oAddCustomer = new CustomerAdd();

            oAddCustomer.Profile = oProfile;

            //Enhancement:
            //could look up a group and add group to the CustomerAdd object to organize users for this app

            //Please Note:
            //User will be in 'Pending user action', which is good for security
            //can still add MFA to 'Pending' users and they can't log into Okta
            //If you want them to be Activated then set the Password

            return(JsonHelper.Post($"https://{_apiUrlBase}/api/v1/users?activate=true", JsonHelper.JsonContent(oAddCustomer), _oktaToken));
        }
        public static dynamic ActivateUserSMS(SMSViewModel model)
        {
            var oActivateVerifySMS = new ActivateVerifySMS();


            //   api/v1/users/${userId}/factors/${factorId}/lifecycle/activate
            //   api/v1/users/${userId}/factors/${factorId}/verify

            var sJsonResponse = JsonHelper.Post($"https://{_apiUrlBase}/api/v1/users/{model.UserId}/factors", JsonHelper.JsonContent(oActivateVerifySMS), _oktaToken);

            return(JsonConvert.DeserializeObject(sJsonResponse));
        }
        public static dynamic EnrollUserSMS(SMSViewModel model)
        {
            var oEnrollSMS = new EnrollSMS();

            oEnrollSMS.Profile.PhoneNumber = String.Format("+{0}-{1}", model.CountryCode, model.PhoneNumber);//Format - "+1-2223334444"

            var sJsonResponse = JsonHelper.Post($"https://{_apiUrlBase}/api/v1/users/{model.UserId}/factors", JsonHelper.JsonContent(oEnrollSMS), _oktaToken);

            return(JsonConvert.DeserializeObject(sJsonResponse));
        }