示例#1
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));
        }
示例#2
0
        public static TokenIntrospectionResponse IntrospectToken(string token)
        {
            var sJsonResponse = JsonHelper.Post($"https://{_apiUrlBase}/oauth2/{_oktaOAuthIssuerId}/v1/introspect?token={token}&token_type_hint=access_token", null, null, _oktaOAuthHeaderAuth);

            return(JsonConvert.DeserializeObject <TokenIntrospectionResponse>(sJsonResponse));
        }
示例#3
0
        public static OIDCTokenResponse GetToken(string oktaAuthCode)
        {
            var sJsonResponse = JsonHelper.Post($"https://{_apiUrlBase}/oauth2/{_oktaOAuthIssuerId}/v1/token?code={oktaAuthCode}&grant_type=authorization_code&redirect_uri={_oktaOAuthRedirectUri}", null, null, _oktaOAuthHeaderAuth);

            return(JsonConvert.DeserializeObject <OIDCTokenResponse>(sJsonResponse));
        }
示例#4
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));;
        }
示例#5
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));
        }
示例#6
0
        public static Customer GetCustomerById(string Id)
        {
            var sJsonResponse = JsonHelper.Get($"https://{_apiUrlBase}/api/v1/users/{Id}", _oktaToken);

            return(JsonConvert.DeserializeObject <Customer>(sJsonResponse));
        }
示例#7
0
        public static IEnumerable <BaseCustomer> GetAllCustomers()
        {
            var sJsonResponse = JsonHelper.Get($"https://{_apiUrlBase}/api/v1/users?limit=100", _oktaToken);

            return(JsonConvert.DeserializeObject <IEnumerable <BaseCustomer> >(sJsonResponse));
        }