diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9481584..b78db35 100755
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,16 +1,42 @@
> **LoginRadius .NET SDK Change Log** provides information regarding what has changed, more specifically what changes, improvements and bug fix has been made to the SDK. For more details please refer to the [LoginRadius API Documention](https://docs.loginradius.com/api/v2/sdk-libraries/aspnet)
-### Version 5.2.2
-Release on **April 12, 2019**
+### Version 10.0.0-beta
+Release on **August 5, 2019**
-##### Bug Fixes
- - Fixed Dictionary concurrency error in ConfigManager.
+##### Enhancements
-### Version 5.2.1
-Release on **March 19, 2019**
+This beta version release includes major changes with several improvements and optimizations :
-##### Enhancements
- - Added gzip Accept-Encoding HTTPS header in requests sent to LoginRadius server
+- Enhanced the coding standards of SDK to follow industry programming styles and best practices.
+- Enhanced security standards of SDK.
+- Reduced code between the business layer and persistence layer for optimization of SDK performance.
+- Added internal parameter validations in the API function.
+- ApiKey and ApiSecret usage redundancy removed.
+- All LoginRadius related features need to be defined once only and SDK will handle them automatically.
+- Improved the naming conventions of API functions for better readability.
+- Better Error and Exception Handling for LoginRadius API Response in SDK.
+- Revamped complete SDK and restructured it with latest API function names and parameters.
+- Added detailed description to API functions and parameters for better understanding.
+- Updated the demo according to latest SDK changes.
+- Implemented API Region Feature.
+
+
+##### Added new multiple APIs for better user experience
+
+- Update Phone ID by UID
+- Upsert Email
+- Role Context profile
+- MFA Resend OTP
+- User Registration By Captcha
+- Get Access Token via Linkedin Token
+- Get Access Token By Foursquare Access Token
+- Get Active Session By Account Id
+- Get Active Session By Profile Id
+
+
+##### Removed APIs:
+
+- GetCompanies API
### Version 5.2.0
Release on **January 15, 2019**
diff --git a/README.md b/README.md
index 4d14228..e313a66 100755
--- a/README.md
+++ b/README.md
@@ -20,6 +20,3224 @@ Please visit [here](http://www.loginradius.com/) for more information.
* .NET 4.0 or later / .NetStandard 1.3 or later
-## Getting Started
+## Installation
+This documentation presumes you have worked through the client-side implementation to setup your LoginRadius User Registration interfaces that will serve the initial registration and login process. Details on this can be found in the [getting started guide](/api/v2/getting-started/introduction).
+
+**Note: **LoginRadius uses the industry standard TLS 1.2 protocol, designed to help protect the privacy of information communicated over the Internet. In order to use the LoginRadius .Net SDK, add the following code before instantiating your web service in your project's `Global.asax` file.
+
+```
+ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
+```
+
+## Importing Required Libraries
+- Download the User Registration .Net SDK from [Github](https://github.com/LoginRadius/dot-net-sdk)
+
+- Copy LoginRadiusSDK.V2.dll and LoginRadiusSDK.V2.pdb files into the References directory of your ASP.NET project.
+
+OR
+
+- Run the following command in the NuGet Package Manager Console:
+
+```
+PM> Install-Package LoginRadiusSDK.NET
+```
+
+OR
+
+- Open the solution using Visual Studio 2019.
+
+- Build the project and note where the .nupkg file is located.
+
+- Access the NuGet Package Manager Settings and import the directory where the .nupkg file is located.
+
+- Access the "Manage NuGet Packages for Solutions..." tool change the source to the newly created source and select and install the LoginRadius SDK
+
+Next, include the following namespaces in your project:
+
+
+```
+using LoginRadiusSDK.V2.Api;
+using LoginRadiusSDK.V2.Models;
+```
+##Quickstart Guide
+
+Set your [app credentials](/api/v2/getting-started/get-api-key-and-secret):
+
+```
+LoginRadiusSdkGlobalConfig.ApiKey = "__API_KEY__";
+LoginRadiusSdkGlobalConfig.ApiSecret = "__API_SECRET__";
+LoginRadiusSdkGlobalConfig.AppName = "__LoginRadius_APP_NAME__";
+LoginRadiusSdkGlobalConfig.ApiRequestSigning ="false";
+LoginRadiusSdkGlobalConfig.ConnectionTimeout = 30000; // Connection Timeout (milliseconds)
+LoginRadiusSdkGlobalConfig.ProxyAddress = "__HTTP_PROXY_ADDRESS__"; // Absolute Proxy URI
+LoginRadiusSdkGlobalConfig.ProxyCredentials = "__HTTP_PROXY_CREDENTIALS__"; // Proxy Credentials in the format 'USERNAME:PASSWORD'
+LoginRadiusSdkGlobalConfig.RequestRetries = 3;
+LoginRadiusSdkGlobalConfig.ApiRegion = "_region_";
+LoginRadiusSdkGlobalConfig.DomainName = "https://api.loginradius.com/";
+```
+
+OR
+
+For ASP.NET. in `web.config`:
+```
+
+[PUT : Auth Update Profile by Token](#UpdateProfileByAccessToken-put-)
+[PUT : Auth Unlock Account by Access Token](#UnlockAccountByToken-put-)
+[PUT : Auth Verify Email By OTP](#VerifyEmailByOTP-put-)
+[PUT : Auth Reset Password by Security Answer and Email](#ResetPasswordBySecurityAnswerAndEmail-put-)
+[PUT : Auth Reset Password by Security Answer and Phone](#ResetPasswordBySecurityAnswerAndPhone-put-)
+[PUT : Auth Reset Password by Security Answer and UserName](#ResetPasswordBySecurityAnswerAndUserName-put-)
+[PUT : Auth Reset Password by Reset Token](#ResetPasswordByResetToken-put-)
+[PUT : Auth Reset Password by OTP](#ResetPasswordByEmailOTP-put-)
+[PUT : Auth Reset Password by OTP and UserName](#ResetPasswordByOTPAndUserName-put-)
+[PUT : Auth Change Password](#ChangePassword-put-)
+[PUT : Auth Link Social Identities](#LinkSocialIdentities-put-)
+[PUT : Auth Set or Change UserName](#SetOrChangeUserName-put-)
+[PUT : Auth Resend Email Verification](#AuthResendEmailVerification-put-)
+[POST : Auth Add Email](#AddEmail-post-)
+[POST : Auth Login by Email](#LoginByEmail-post-)
+[POST : Auth Login by Username](#LoginByUserName-post-)
+[POST : Auth Forgot Password](#ForgotPassword-post-)
+[POST : Auth User Registration by Email](#UserRegistrationByEmail-post-)
+[POST : Phone User Registration by SMS](#UserRegistrationByPhone-post-)
+[POST : Auth User Registration By Captcha](#UserRegistrationByCaptcha-post-)
+[GET : Get Security Questions By Email](#GetSecurityQuestionsByEmail-get-)
+[GET : Get Security Questions By UserName](#GetSecurityQuestionsByUserName-get-)
+[GET : Get Security Questions By Phone](#GetSecurityQuestionsByPhone-get-)
+[GET : Get Security Questions By Access Token](#GetSecurityQuestionsByAccessToken-get-)
+[GET : Auth Validate Access token](#AuthValidateAccessToken-get-)
+[GET : Access Token Invalidate](#AuthInValidateAccessToken-get-)
+[GET : Access Token Info](#GetAccessTokenInfo-get-)
+[GET : Auth Read all Profiles by Token](#GetProfileByAccessToken-get-)
+[GET : Auth Send Welcome Email](#SendWelcomeEmail-get-)
+[GET : Auth Delete Account](#DeleteAccountByDeleteToken-get-)
+[GET : Auth Check Email Availability](#CheckEmailAvailability-get-)
+[GET : Auth Verify Email](#VerifyEmail-get-)
+[GET : Auth Social Identity](#GetSocialIdentity-get-)
+[GET : Auth Check UserName Availability](#CheckUserNameAvailability-get-)
+[GET : Auth Privacy Policy Accept](#AcceptPrivacyPolicy-get-)
+[GET : Auth Privacy Policy History By Access Token](#GetPrivacyPolicyHistoryByAccessToken-get-)
+[DELETE : Auth Delete Account with Email Confirmation](#DeleteAccountWithEmailConfirmation-delete-)
+[DELETE : Auth Remove Email](#RemoveEmail-delete-)
+[DELETE : Auth Unlink Social Identities](#UnlinkSocialIdentities-delete-)
+
+
+
+
",
+IsActive = true,
+Key ="",
+ParentId ="",
+Type ="",
+Value =""
+}}
+}; //Required
+var apiResponse = new CustomRegistrationDataApi().AddRegistrationData(registrationDataCreateModelList);
+```
+
+
+Auth Get Registration Data Server (GET)
+This API is used to retrieve dropdown data. [More Info](https://www.loginradius.com/docs/api/v2/customer-identity-api/custom-registration-data/auth-get-registration-data)
+
+
+
+```
+
+var type = "type"; //Required
+var limit = 0; //Optional
+var parentId = "parentId"; //Optional
+var skip = 0; //Optional
+var apiResponse = new CustomRegistrationDataApi().AuthGetRegistrationData(type, limit, parentId, skip);
+```
+
+
+Get Registration Data (GET)
+This API is used to retrieve dropdown data. [More Info](https://www.loginradius.com/docs/api/v2/customer-identity-api/custom-registration-data/get-registration-data)
+
+
+
+```
+
+var type = "type"; //Required
+var limit = 0; //Optional
+var parentId = "parentId"; //Optional
+var skip = 0; //Optional
+var apiResponse = new CustomRegistrationDataApi().GetRegistrationData(type, limit, parentId, skip);
+```
+
+
+Delete Registration Data (DELETE)
+This API allows you to delete an item from a dropdown list. [More Info](https://www.loginradius.com/docs/api/v2/customer-identity-api/custom-registration-data/delete-registration-data)
+
+
+
+```
+
+var recordId = "recordId"; //Required
+var apiResponse = new CustomRegistrationDataApi().DeleteRegistrationData(recordId);
+```
+
+
+Delete All Records by Datasource (DELETE)
+This API allows you to delete all records contained in a datasource. [More Info](https://www.loginradius.com/docs/api/v2/customer-identity-api/custom-registration-data/delete-all-records-by-datasource)
+
+
+
+```
+
+var type = "type"; //Required
+var apiResponse = new CustomRegistrationDataApi().DeleteAllRecordsByDataSource(type);
+```
+
+
+
+
+
+
+
+### RiskBasedAuthentication API
+
+
+List of APIs in this Section:
+[POST : Risk Based Authentication Login by Email](#RBALoginByEmail-post-)
+[POST : Risk Based Authentication Login by Username](#RBALoginByUserName-post-)
+[POST : Risk Based Authentication Phone Login](#RBALoginByPhone-post-)
+
+
+
+Risk Based Authentication Login by Email (POST)
+This API retrieves a copy of the user data based on the Email [More Info](https://www.loginradius.com/docs/api/v2/customer-identity-api/authentication/auth-login-by-email)
+
+
+
+```
+
+EmailAuthenticationModel emailAuthenticationModel = new EmailAuthenticationModel{
+Email ="",
+Password =""
+}; //Required
+var emailTemplate = "emailTemplate"; //Optional
+string fields = null; //Optional
+var loginUrl = "loginUrl"; //Optional
+var passwordDelegation = true; //Optional
+var passwordDelegationApp = "passwordDelegationApp"; //Optional
+var rbaBrowserEmailTemplate = "rbaBrowserEmailTemplate"; //Optional
+var rbaBrowserSmsTemplate = "rbaBrowserSmsTemplate"; //Optional
+var rbaCityEmailTemplate = "rbaCityEmailTemplate"; //Optional
+var rbaCitySmsTemplate = "rbaCitySmsTemplate"; //Optional
+var rbaCountryEmailTemplate = "rbaCountryEmailTemplate"; //Optional
+var rbaCountrySmsTemplate = "rbaCountrySmsTemplate"; //Optional
+var rbaIpEmailTemplate = "rbaIpEmailTemplate"; //Optional
+var rbaIpSmsTemplate = "rbaIpSmsTemplate"; //Optional
+var rbaOneclickEmailTemplate = "rbaOneclickEmailTemplate"; //Optional
+var rbaOTPSmsTemplate = "rbaOTPSmsTemplate"; //Optional
+var smsTemplate = "smsTemplate"; //Optional
+var verificationUrl = "verificationUrl"; //Optional
+var apiResponse = new RiskBasedAuthenticationApi().RBALoginByEmail(emailAuthenticationModel, emailTemplate, fields, loginUrl, passwordDelegation, passwordDelegationApp, rbaBrowserEmailTemplate, rbaBrowserSmsTemplate, rbaCityEmailTemplate, rbaCitySmsTemplate, rbaCountryEmailTemplate, rbaCountrySmsTemplate, rbaIpEmailTemplate, rbaIpSmsTemplate, rbaOneclickEmailTemplate, rbaOTPSmsTemplate, smsTemplate, verificationUrl);
+```
+
+
+Risk Based Authentication Login by Username (POST)
+This API retrieves a copy of the user data based on the Username [More Info](https://www.loginradius.com/docs/api/v2/customer-identity-api/authentication/auth-login-by-username)
+
+
+
+```
+
+UserNameAuthenticationModel userNameAuthenticationModel = new UserNameAuthenticationModel{
+Password ="",
+Username =""
+}; //Required
+var emailTemplate = "emailTemplate"; //Optional
+string fields = null; //Optional
+var loginUrl = "loginUrl"; //Optional
+var passwordDelegation = true; //Optional
+var passwordDelegationApp = "passwordDelegationApp"; //Optional
+var rbaBrowserEmailTemplate = "rbaBrowserEmailTemplate"; //Optional
+var rbaBrowserSmsTemplate = "rbaBrowserSmsTemplate"; //Optional
+var rbaCityEmailTemplate = "rbaCityEmailTemplate"; //Optional
+var rbaCitySmsTemplate = "rbaCitySmsTemplate"; //Optional
+var rbaCountryEmailTemplate = "rbaCountryEmailTemplate"; //Optional
+var rbaCountrySmsTemplate = "rbaCountrySmsTemplate"; //Optional
+var rbaIpEmailTemplate = "rbaIpEmailTemplate"; //Optional
+var rbaIpSmsTemplate = "rbaIpSmsTemplate"; //Optional
+var rbaOneclickEmailTemplate = "rbaOneclickEmailTemplate"; //Optional
+var rbaOTPSmsTemplate = "rbaOTPSmsTemplate"; //Optional
+var smsTemplate = "smsTemplate"; //Optional
+var verificationUrl = "verificationUrl"; //Optional
+var apiResponse = new RiskBasedAuthenticationApi().RBALoginByUserName(userNameAuthenticationModel, emailTemplate, fields, loginUrl, passwordDelegation, passwordDelegationApp, rbaBrowserEmailTemplate, rbaBrowserSmsTemplate, rbaCityEmailTemplate, rbaCitySmsTemplate, rbaCountryEmailTemplate, rbaCountrySmsTemplate, rbaIpEmailTemplate, rbaIpSmsTemplate, rbaOneclickEmailTemplate, rbaOTPSmsTemplate, smsTemplate, verificationUrl);
+```
+
+
+Risk Based Authentication Phone Login (POST)
+This API retrieves a copy of the user data based on the Phone [More Info](https://www.loginradius.com/docs/api/v2/customer-identity-api/phone-authentication/phone-login)
+
+
+
+```
+
+PhoneAuthenticationModel phoneAuthenticationModel = new PhoneAuthenticationModel{
+Password ="",
+Phone =""
+}; //Required
+var emailTemplate = "emailTemplate"; //Optional
+string fields = null; //Optional
+var loginUrl = "loginUrl"; //Optional
+var passwordDelegation = true; //Optional
+var passwordDelegationApp = "passwordDelegationApp"; //Optional
+var rbaBrowserEmailTemplate = "rbaBrowserEmailTemplate"; //Optional
+var rbaBrowserSmsTemplate = "rbaBrowserSmsTemplate"; //Optional
+var rbaCityEmailTemplate = "rbaCityEmailTemplate"; //Optional
+var rbaCitySmsTemplate = "rbaCitySmsTemplate"; //Optional
+var rbaCountryEmailTemplate = "rbaCountryEmailTemplate"; //Optional
+var rbaCountrySmsTemplate = "rbaCountrySmsTemplate"; //Optional
+var rbaIpEmailTemplate = "rbaIpEmailTemplate"; //Optional
+var rbaIpSmsTemplate = "rbaIpSmsTemplate"; //Optional
+var rbaOneclickEmailTemplate = "rbaOneclickEmailTemplate"; //Optional
+var rbaOTPSmsTemplate = "rbaOTPSmsTemplate"; //Optional
+var smsTemplate = "smsTemplate"; //Optional
+var verificationUrl = "verificationUrl"; //Optional
+var apiResponse = new RiskBasedAuthenticationApi().RBALoginByPhone(phoneAuthenticationModel, emailTemplate, fields, loginUrl, passwordDelegation, passwordDelegationApp, rbaBrowserEmailTemplate, rbaBrowserSmsTemplate, rbaCityEmailTemplate, rbaCitySmsTemplate, rbaCountryEmailTemplate, rbaCountrySmsTemplate, rbaIpEmailTemplate, rbaIpSmsTemplate, rbaOneclickEmailTemplate, rbaOTPSmsTemplate, smsTemplate, verificationUrl);
+```
+
+
+
+
+
+
+
+### Sott API
+
+
+List of APIs in this Section:
+[GET : Generate SOTT](#GenerateSott-get-)
+
+
+
+Generate SOTT (GET)
+This API allows you to generate SOTT with a given expiration time. [More Info](https://www.loginradius.com/docs/api/v2/customer-identity-api/session/generate-sott-token)
+
+
+
+```
+
+var timeDifference = 0; //Optional
+var apiResponse = new SottApi().GenerateSott(timeDifference);
+```
+
+
+
+
+
+
+
+### NativeSocial API
+
+
+List of APIs in this Section:
+[GET : Access Token via Facebook Token](#GetAccessTokenByFacebookAccessToken-get-)
+[GET : Access Token via Twitter Token](#GetAccessTokenByTwitterAccessToken-get-)
+[GET : Access Token via Google Token](#GetAccessTokenByGoogleAccessToken-get-)
+[GET : LoginRadius Access Token using google JWT token for Native Mobile Login](#GetAccessTokenByGoogleJWTAccessToken-get-)
+[GET : Access Token via Linkedin Token](#GetAccessTokenByLinkedinAccessToken-get-)
+[GET : Get Access Token By Foursquare Access Token](#GetAccessTokenByFoursquareAccessToken-get-)
+[GET : Access Token via Vkontakte Token](#GetAccessTokenByVkontakteAccessToken-get-)
+[GET : Access Token via Google AuthCode](#GetAccessTokenByGoogleAuthCode-get-)
+
+
+
+Access Token via Facebook Token (GET)
+The API is used to get LoginRadius access token by sending Facebook’s access token. It will be valid for the specific duration of time specified in the response. [More Info](https://www.loginradius.com/docs/api/v2/customer-identity-api/social-login/native-social-login-api/access-token-via-facebook-token/)
+
+
+
+```
+
+var fbAccessToken = "fbAccessToken"; //Required
+var apiResponse = new NativeSocialApi().GetAccessTokenByFacebookAccessToken(fbAccessToken);
+```
+
+
+Access Token via Twitter Token (GET)
+The API is used to get LoginRadius access token by sending Twitter’s access token. It will be valid for the specific duration of time specified in the response. [More Info](https://www.loginradius.com/docs/api/v2/customer-identity-api/social-login/native-social-login-api/access-token-via-twitter-token)
+
+
+
+```
+
+var twAccessToken = "twAccessToken"; //Required
+var twTokenSecret = "twTokenSecret"; //Required
+var apiResponse = new NativeSocialApi().GetAccessTokenByTwitterAccessToken(twAccessToken, twTokenSecret);
+```
+
+
+Access Token via Google Token (GET)
+The API is used to get LoginRadius access token by sending Google’s access token. It will be valid for the specific duration of time specified in the response. [More Info](https://www.loginradius.com/docs/api/v2/customer-identity-api/social-login/native-social-login-api/access-token-via-google-token)
+
+
+
+```
+
+var googleAccessToken = "googleAccessToken"; //Required
+var clientId = "clientId"; //Optional
+var refreshToken = "refreshToken"; //Optional
+var apiResponse = new NativeSocialApi().GetAccessTokenByGoogleAccessToken(googleAccessToken, clientId, refreshToken);
+```
+
+
+LoginRadius Access Token using google JWT token for Native Mobile Login (GET)
+This API is used to Get LoginRadius Access Token using google jwt id token for google native mobile login/registration. [More Info](https://www.loginradius.com/docs/api/v2/customer-identity-api/social-login/native-social-login-api/access-token-via-googlejwt)
+
+
+
+```
+
+var idToken = "idToken"; //Required
+var apiResponse = new NativeSocialApi().GetAccessTokenByGoogleJWTAccessToken(idToken);
+```
+
+
+Access Token via Linkedin Token (GET)
+The API is used to get LoginRadius access token by sending Linkedin’s access token. It will be valid for the specific duration of time specified in the response. [More Info](https://www.loginradius.com/docs/api/v2/customer-identity-api/social-login/native-social-login-api/access-token-via-linkedin-token/)
+
+
+
+```
+
+var lnAccessToken = "lnAccessToken"; //Required
+var apiResponse = new NativeSocialApi().GetAccessTokenByLinkedinAccessToken(lnAccessToken);
+```
+
+
+Get Access Token By Foursquare Access Token (GET)
+The API is used to get LoginRadius access token by sending Foursquare’s access token. It will be valid for the specific duration of time specified in the response. [More Info](https://www.loginradius.com/docs/api/v2/customer-identity-api/social-login/native-social-login-api/access-token-via-foursquare-token/)
+
+
+
+```
+
+var fsAccessToken = "fsAccessToken"; //Required
+var apiResponse = new NativeSocialApi().GetAccessTokenByFoursquareAccessToken(fsAccessToken);
+```
+
+
+Access Token via Vkontakte Token (GET)
+The API is used to get LoginRadius access token by sending Vkontakte’s access token. It will be valid for the specific duration of time specified in the response. [More Info](https://www.loginradius.com/docs/api/v2/customer-identity-api/social-login/native-social-login-api/access-token-via-vkontakte-token)
+
+
+
+```
+
+var vkAccessToken = "vkAccessToken"; //Required
+var apiResponse = new NativeSocialApi().GetAccessTokenByVkontakteAccessToken(vkAccessToken);
+```
+
+
+Access Token via Google AuthCode (GET)
+The API is used to get LoginRadius access token by sending Google’s AuthCode. It will be valid for the specific duration of time specified in the response. [More Info](https://www.loginradius.com/docs/api/v2/customer-identity-api/social-login/native-social-login-api/access-token-via-google-auth-code)
+
+
+
+```
+
+var googleAuthcode = "googleAuthcode"; //Required
+var apiResponse = new NativeSocialApi().GetAccessTokenByGoogleAuthCode(googleAuthcode);
+```
+
+
+
+
+
+
+
+### WebHook API
+
+
+List of APIs in this Section:
+[POST : Webhook Subscribe](#WebHookSubscribe-post-)
+[GET : Webhook Subscribed URLs](#GetWebHookSubscribedURLs-get-)
+[GET : Webhook Test](#WebhookTest-get-)
+[DELETE : WebHook Unsubscribe](#WebHookUnsubscribe-delete-)
+
+
+
+Webhook Subscribe (POST)
+API can be used to configure a WebHook on your LoginRadius site. Webhooks also work on subscribe and notification model, subscribe your hook and get a notification. Equivalent to RESThook but these provide security on basis of signature and RESThook work on unique URL. Following are the events that are allowed by LoginRadius to trigger a WebHook service call. [More Info](https://www.loginradius.com/docs/api/v2/integrations/webhooks/webhook-subscribe)
+
+
+
+```
+
+WebHookSubscribeModel webHookSubscribeModel = new WebHookSubscribeModel{
+Event ="",
+TargetUrl =""
+}; //Required
+var apiResponse = new WebHookApi().WebHookSubscribe(webHookSubscribeModel);
+```
+
+
+Webhook Subscribed URLs (GET)
+This API is used to fatch all the subscribed URLs, for particular event [More Info](https://www.loginradius.com/docs/api/v2/integrations/webhooks/webhook-subscribed-urls)
+
+
+
+```
+
+var @event = "@event"; //Required
+var apiResponse = new WebHookApi().GetWebHookSubscribedURLs(@event);
+```
+
+
+Webhook Test (GET)
+API can be used to test a subscribed WebHook. [More Info](https://www.loginradius.com/docs/api/v2/integrations/webhooks/webhook-test)
+
+
+
+```
+
+var apiResponse = new WebHookApi().WebhookTest();
+```
+
+
+WebHook Unsubscribe (DELETE)
+API can be used to unsubscribe a WebHook configured on your LoginRadius site. [More Info](https://www.loginradius.com/docs/api/v2/integrations/webhooks/webhook-unsubscribe)
+
+
+
+```
+
+WebHookSubscribeModel webHookSubscribeModel = new WebHookSubscribeModel{
+Event ="",
+TargetUrl =""
+}; //Required
+var apiResponse = new WebHookApi().WebHookUnsubscribe(webHookSubscribeModel);
+```
+
+
+
+
+
+
+
+## Demo
+We have configured a sample ASP.net project with extended social profile data, webhook Apis, Account APis. You can get a copy of our demo project at [GitHub](https://github.com/LoginRadius/dot-net-sdk/tree/master/Samples/dot-net-demo).
-* Everything you need begin using this SDK: [LoginRadius Developer documentation](https://www.loginradius.com/docs/api/v2/deployment/sdk-libraries/asp-net-library)
\ No newline at end of file
diff --git a/Samples/dot-net-demo/dot-net-demo/Controllers/HomeController.cs b/Samples/dot-net-demo/dot-net-demo/Controllers/HomeController.cs
index 8eea349..7bde963 100644
--- a/Samples/dot-net-demo/dot-net-demo/Controllers/HomeController.cs
+++ b/Samples/dot-net-demo/dot-net-demo/Controllers/HomeController.cs
@@ -2,22 +2,18 @@
using System.Diagnostics;
using Microsoft.AspNetCore.Mvc;
using dot_net_demo.Models;
-using LoginRadiusSDK.V2.Api;
-using LoginRadiusSDK.V2.Models;
-using LoginRadiusSDK.V2.Models.CustomerAuthentication.Login;
-using LoginRadiusSDK.V2.Models.Password;
-using LoginRadiusSDK.V2.Models.UserProfile;
-using LoginRadiusSDK.V2.Models.CustomerAuthentication._2FA;
-using LoginRadiusSDK.V2;
+
+using LoginRadiusSDK.V2.Api.Advanced;
+using LoginRadiusSDK.V2.Api.Authentication;
+using LoginRadiusSDK.V2.Models.RequestModels;
+
+using LoginRadiusSDK.V2.Common;
+using LoginRadiusSDK.V2.Api.Account;
namespace dot_net_demo.Controllers
{
public class HomeController : Controller
{
- LoginRadiusApiOptionalParams _apiOptionalParams = new LoginRadiusApiOptionalParams();
-
-
-
public IActionResult Index()
{
return View();
@@ -46,13 +42,15 @@ public IActionResult Profile()
[HttpPost]
public IActionResult LRLogin([FromBody] EmailLoginModel emailLoginModel)
{
- Debug.WriteLine(BaseConstants.RestAuthApiEndpoint);
- Debug.WriteLine(LoginRadiusSdkGlobalConfig.DomainName);
- _apiOptionalParams.VerificationUrl = "";
- _apiOptionalParams.G_Recaptcha_Response = "";
+ string fields = null;
+ EmailAuthenticationModel log = new EmailAuthenticationModel
+ {
+ Email = emailLoginModel.Email,
+ Password = emailLoginModel.Password
+ };
+ var apiresponse = new AuthenticationApi().LoginByEmail(log, fields);
- var apiresponse = new AuthenticationApi().LoginByEmail(emailLoginModel.ConvertToJson(), _apiOptionalParams);
- if(apiresponse.RestException != null)
+ if (apiresponse.RestException != null)
{
return StatusCode(400, Json(apiresponse.RestException));
}
@@ -61,8 +59,7 @@ public IActionResult LRLogin([FromBody] EmailLoginModel emailLoginModel)
public IActionResult LRMfaLogin([FromBody] EmailLoginModel emailLoginModel)
{
- _apiOptionalParams.SmsTemplate = "";
- var apiresponse = new MultifactorApi().MultifactorAuthLoginByEmail(emailLoginModel.email, emailLoginModel.password, _apiOptionalParams);
+ var apiresponse = new MultiFactorAuthenticationApi().MFALoginByEmail(emailLoginModel.Email, emailLoginModel.Password);
if (apiresponse.RestException != null)
{
return StatusCode(400, Json(apiresponse.RestException));
@@ -72,7 +69,7 @@ public IActionResult LRMfaLogin([FromBody] EmailLoginModel emailLoginModel)
public IActionResult LRMfaAuth([FromBody] GoogleAuthenticatorModel googleAuth, [FromQuery(Name = "multi_factor_auth_token")] String secondFactorAuthToken)
{
- var apiresponse = new MultifactorApi().ValidateGoogleAuthCode(secondFactorAuthToken, googleAuth.googleauthenticatorcode, "");
+ var apiresponse = new MultiFactorAuthenticationApi().MFAValidateGoogleAuthCode(googleAuth.googleauthenticatorcode, secondFactorAuthToken);
if (apiresponse.RestException != null)
{
return StatusCode(400, Json(apiresponse.RestException));
@@ -82,7 +79,7 @@ public IActionResult LRMfaAuth([FromBody] GoogleAuthenticatorModel googleAuth, [
public IActionResult LRPwlessLogin([FromQuery(Name = "email")] String email, [FromQuery(Name = "verification_url")] String verificationUrl)
{
- var apiresponse = new PasswordlessLoginApi().PasswordlessLoginByEmail(email, "", verificationUrl);
+ var apiresponse = new PasswordLessLoginApi().PasswordlessLoginByEmail(email, "", verificationUrl);
if (apiresponse.RestException != null)
{
return StatusCode(400, Json(apiresponse.RestException));
@@ -92,7 +89,8 @@ public IActionResult LRPwlessLogin([FromQuery(Name = "email")] String email, [Fr
public IActionResult LRPwlessAuth([FromQuery(Name = "verification_token")] String verificationToken)
{
- var apiresponse = new PasswordlessLoginApi().PasswordlessLoginVerification(verificationToken, "");
+ var apiresponse = new PasswordLessLoginApi().PasswordlessLoginVerification(verificationToken);
+
if (apiresponse.RestException != null)
{
return StatusCode(400, Json(apiresponse.RestException));
@@ -100,18 +98,15 @@ public IActionResult LRPwlessAuth([FromQuery(Name = "verification_token")] Strin
return Json(apiresponse.Response);
}
- public IActionResult LRRegister([FromBody] UserIdentityCreateModel identityCreateModel, [FromQuery(Name = "verification_url")] String verificationUrl)
+ public IActionResult LRRegister([FromBody] AuthUserRegistrationModel identityCreateModel, [FromQuery(Name = "verification_url")] String verificationUrl)
{
- _apiOptionalParams.SmsTemplate = "";
- _apiOptionalParams.EmailTemplate = "";
- _apiOptionalParams.VerificationUrl = verificationUrl;
-
+ LoginRadiusSecureOneTimeToken _sott = new LoginRadiusSecureOneTimeToken();
var sott = new SottRequest
{
TimeDifference = "50"
};
-
- var apiresponse = new AuthenticationApi().RegisterCustomer(identityCreateModel, _apiOptionalParams, sott);
+ var apiresponse = new AuthenticationApi().UserRegistrationByEmail(identityCreateModel, _sott.GetSott(sott), null,null, verificationUrl,null);
+
if (apiresponse.RestException != null)
{
return StatusCode(400, Json(apiresponse.RestException));
@@ -122,6 +117,7 @@ public IActionResult LRRegister([FromBody] UserIdentityCreateModel identityCreat
public IActionResult LRVerifyEmail([FromQuery(Name = "verification_token")] String verificationToken)
{
var apiresponse = new AuthenticationApi().VerifyEmail(verificationToken, "google.ca", "");
+
if (apiresponse.RestException != null)
{
return StatusCode(400, Json(apiresponse.RestException));
@@ -132,6 +128,7 @@ public IActionResult LRVerifyEmail([FromQuery(Name = "verification_token")] Stri
public IActionResult LRForgotPassword([FromBody] ForgotPasswordModel forgotPassModel, [FromQuery(Name = "reset_password_url")] String resetPasswordUrl)
{
var apiresponse = new AuthenticationApi().ForgotPassword(forgotPassModel.Email, resetPasswordUrl, "");
+
if (apiresponse.RestException != null)
{
return StatusCode(400, Json(apiresponse.RestException));
@@ -141,7 +138,13 @@ public IActionResult LRForgotPassword([FromBody] ForgotPasswordModel forgotPassM
public IActionResult LRResetPasswordEmail([FromBody] ResetPasswordModel resetPasswordModel)
{
- var apiresponse = new AuthenticationApi().ResetPassword(resetPasswordModel);
+ ResetPasswordByResetTokenModel reset = new ResetPasswordByResetTokenModel
+ {
+ Password = resetPasswordModel.password,
+ ResetToken = resetPasswordModel.resettoken
+ };
+ var apiresponse = new AuthenticationApi().ResetPasswordByResetToken(reset);
+
if (apiresponse.RestException != null)
{
return StatusCode(400, Json(apiresponse.RestException));
@@ -151,7 +154,8 @@ public IActionResult LRResetPasswordEmail([FromBody] ResetPasswordModel resetPas
public IActionResult LRChangePassword([FromBody] ChangePasswordModel changePasswordModel, [FromQuery(Name = "auth")] String accessToken)
{
- var apiresponse = new AuthenticationApi().ChangePassword(accessToken, changePasswordModel);
+ var apiresponse = new AuthenticationApi().ChangePassword(accessToken, changePasswordModel.newPassword, changePasswordModel.oldPassword);
+
if (apiresponse.RestException != null)
{
return StatusCode(400, Json(apiresponse.RestException));
@@ -161,17 +165,17 @@ public IActionResult LRChangePassword([FromBody] ChangePasswordModel changePassw
public IActionResult LRSetPassword([FromBody] SetPasswordModel setPasswordModel, [FromQuery(Name = "uid")] String uid)
{
- var apiresponse = new AccountApi().SetAccountPassword(uid, setPasswordModel.Password);
- if (apiresponse.RestException != null)
- {
- return StatusCode(400, Json(apiresponse.RestException));
- }
- return Json(apiresponse.Response);
+ var apiresponse = new AccountApi().SetAccountPasswordByUid(setPasswordModel.Password, uid);
+ if (apiresponse.RestException != null)
+ {
+ return StatusCode(400, Json(apiresponse.RestException));
+ }
+ return Json(apiresponse.Response);
}
- public IActionResult LRUpdate([FromBody] LoginRadiusAccountUpdateModel updateModel, [FromQuery(Name = "uid")] String uid)
+ public IActionResult LRUpdate([FromBody] AccountUserProfileUpdateModel updateModel, [FromQuery(Name = "uid")] String uid)
{
- var apiresponse = new AccountApi().UpdateAccount(uid, updateModel);
+ var apiresponse = new AccountApi().UpdateAccountByUid(updateModel, uid);
if (apiresponse.RestException != null)
{
return StatusCode(400, Json(apiresponse.RestException));
@@ -181,8 +185,7 @@ public IActionResult LRUpdate([FromBody] LoginRadiusAccountUpdateModel updateMod
public IActionResult LRCreateCustomObject([FromBody] dynamic customObject, [FromQuery(Name = "auth")] String accessToken, [FromQuery(Name = "object_name")] String objectName)
{
- var CustomObject = Newtonsoft.Json.JsonConvert.SerializeObject(customObject);
- var apiresponse = new CustomObjectApi().CreateCustomObjectByToken(accessToken, objectName, CustomObject);
+ var apiresponse = new CustomObjectApi().CreateCustomObjectByToken(accessToken, objectName, customObject);
if (apiresponse.RestException != null)
{
return StatusCode(400, Json(apiresponse.RestException));
@@ -190,11 +193,11 @@ public IActionResult LRCreateCustomObject([FromBody] dynamic customObject, [From
return Json(apiresponse.Response);
}
- public IActionResult LRUpdateCustomObject([FromBody] dynamic customObject, [FromQuery(Name = "auth")] String accessToken, [FromQuery(Name = "object_name")] String objectName,
- [FromQuery(Name = "object_id")] String objectId)
+ public IActionResult LRUpdateCustomObject([FromBody] dynamic customObject, [FromQuery(Name = "auth")] String accessToken, [FromQuery(Name = "object_name")] String objectName, [FromQuery(Name = "object_id")] String objectId)
{
- var CustomObject = Newtonsoft.Json.JsonConvert.SerializeObject(customObject);
- var apiresponse = new CustomObjectApi().UpdateByObjectRecordIdAndAccessToken(accessToken, objectId, objectName, CustomObject, fullReplace: true);
+
+ var apiresponse = new CustomObjectApi().UpdateCustomObjectByToken(accessToken, objectName, objectId, customObject);
+
if (apiresponse.RestException != null)
{
return StatusCode(400, Json(apiresponse.RestException));
@@ -204,7 +207,8 @@ public IActionResult LRUpdateCustomObject([FromBody] dynamic customObject, [From
public IActionResult LRDeleteCustomObject([FromQuery(Name = "auth")] String accessToken, [FromQuery(Name = "object_name")] String objectName, [FromQuery(Name = "object_id")] String objectId)
{
- var apiresponse = new CustomObjectApi().DeleteByRecordIdAndToken(accessToken, objectId, objectName);
+ var apiresponse = new CustomObjectApi().DeleteCustomObjectByToken(accessToken, objectName, objectId);
+
if (apiresponse.RestException != null)
{
return StatusCode(400, Json(apiresponse.RestException));
@@ -214,7 +218,7 @@ public IActionResult LRDeleteCustomObject([FromQuery(Name = "auth")] String acce
public IActionResult LRGetCustomObject([FromQuery(Name = "auth")] String accessToken, [FromQuery(Name = "object_name")] String objectName)
{
- var apiresponse = new CustomObjectApi().GetByAccessToken(accessToken, objectName);
+ var apiresponse = new CustomObjectApi().GetCustomObjectByToken(accessToken, objectName);
if (apiresponse.RestException != null)
{
return StatusCode(400, Json(apiresponse.RestException));
@@ -224,9 +228,7 @@ public IActionResult LRGetCustomObject([FromQuery(Name = "auth")] String accessT
public IActionResult LRMfaResetGoogle([FromQuery(Name = "auth")] String accessToken)
{
- RemoveOrResetMultifactorAuthentication obj = new RemoveOrResetMultifactorAuthentication();
- obj.googleauthenticator = true;
- var apiresponse = new MultifactorApi().RemoveOrResetMultifactorByAccessToken(obj, accessToken);
+ var apiresponse = new MultiFactorAuthenticationApi().MFAResetGoogleAuthByToken(accessToken, true);
if (apiresponse.RestException != null)
{
return StatusCode(400, Json(apiresponse.RestException));
@@ -236,18 +238,17 @@ public IActionResult LRMfaResetGoogle([FromQuery(Name = "auth")] String accessTo
public IActionResult LRMfaValidate([FromQuery(Name = "auth")] String accessToken)
{
- _apiOptionalParams.SmsTemplate = "";
- var apiresponse = new MultifactorApi().GetMultifactorAccessToken(accessToken, _apiOptionalParams);
+ var apiresponse = new MultiFactorAuthenticationApi().MFAConfigureByAccessToken(accessToken);
if (apiresponse.RestException != null)
{
return StatusCode(400, Json(apiresponse.RestException));
}
return Json(apiresponse.Response);
}
-
+
public IActionResult LRMfaEnableGoogle([FromBody] GoogleAuthenticatorModel googleAuthenticatorCode, [FromQuery(Name = "auth")] String accessToken)
{
- var apiresponse = new MultifactorApi().ValidateGoogleAuthCode(accessToken, googleAuthenticatorCode.googleauthenticatorcode);
+ var apiresponse = new MultiFactorAuthenticationApi().MFAValidateGoogleAuthCode(accessToken, googleAuthenticatorCode.googleauthenticatorcode);
if (apiresponse.RestException != null)
{
return StatusCode(400, Json(apiresponse.RestException));
@@ -257,7 +258,7 @@ public IActionResult LRMfaEnableGoogle([FromBody] GoogleAuthenticatorModel googl
public IActionResult LRGetRoles()
{
- var apiresponse = new RolesApi().GetRoles();
+ var apiresponse = new RoleApi().GetRolesList();
if (apiresponse.RestException != null)
{
return StatusCode(400, Json(apiresponse.RestException));
@@ -267,7 +268,7 @@ public IActionResult LRGetRoles()
public IActionResult LRGetRole([FromQuery(Name = "uid")] String uid)
{
- var apiresponse = new RolesApi().GetAccountRole(uid);
+ var apiresponse = new RoleApi().GetRolesByUid(uid);
if (apiresponse.RestException != null)
{
return StatusCode(400, Json(apiresponse.RestException));
@@ -275,9 +276,10 @@ public IActionResult LRGetRole([FromQuery(Name = "uid")] String uid)
return Json(apiresponse.Response);
}
- public IActionResult LRCreateRole([FromBody] LoginRadiusRolesCreate rolePermissions)
+ public IActionResult LRCreateRole([FromBody] RolesModel rolePermissions)
{
- var apiresponse = new RolesApi().CreateRoles(rolePermissions);
+ var apiresponse = new RoleApi().CreateRoles(rolePermissions);
+
if (apiresponse.RestException != null)
{
return StatusCode(400, Json(apiresponse.RestException));
@@ -287,7 +289,7 @@ public IActionResult LRCreateRole([FromBody] LoginRadiusRolesCreate rolePermissi
public IActionResult LRDeleteRole([FromQuery(Name = "role")] String roleName)
{
- var apiresponse = new RolesApi().DeleteRole(roleName);
+ var apiresponse = new RoleApi().DeleteRole(roleName);
if (apiresponse.RestException != null)
{
return StatusCode(400, Json(apiresponse.RestException));
@@ -295,9 +297,9 @@ public IActionResult LRDeleteRole([FromQuery(Name = "role")] String roleName)
return Json(apiresponse.Response);
}
- public IActionResult LRAssignRole([FromQuery(Name = "uid")] String uid, [FromBody] LoginRadiusAccountRolesUpsert roles)
+ public IActionResult LRAssignRole([FromQuery(Name = "uid")] String uid, [FromBody] AccountRolesModel roles)
{
- var apiresponse = new RolesApi().RolesAssignToUser(uid, roles);
+ var apiresponse = new RoleApi().AssignRolesByUid(roles, uid);
if (apiresponse.RestException != null)
{
return StatusCode(400, Json(apiresponse.RestException));
@@ -307,7 +309,7 @@ public IActionResult LRAssignRole([FromQuery(Name = "uid")] String uid, [FromBod
public IActionResult LRGetProfile([FromQuery(Name = "auth")] String accessToken)
{
- var apiresponse = new AuthenticationApi().GetProfile(accessToken);
+ var apiresponse = new AuthenticationApi().GetProfileByAccessToken(accessToken);
if (apiresponse.RestException != null)
{
return StatusCode(400, Json(apiresponse.RestException));
@@ -317,7 +319,10 @@ public IActionResult LRGetProfile([FromQuery(Name = "auth")] String accessToken)
public IActionResult Error()
{
- return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
+ return View(new ErrorViewModel
+ {
+ RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier
+ });
}
}
-}
+}
\ No newline at end of file
diff --git a/Samples/dot-net-demo/dot-net-demo/Controllers/TestController.cs b/Samples/dot-net-demo/dot-net-demo/Controllers/TestController.cs
index 5369047..28b193f 100644
--- a/Samples/dot-net-demo/dot-net-demo/Controllers/TestController.cs
+++ b/Samples/dot-net-demo/dot-net-demo/Controllers/TestController.cs
@@ -1,29 +1,21 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
-using LoginRadiusSDK.V2.Api;
-using LoginRadiusSDK.V2.Models;
-using LoginRadiusSDK.V2.Models.CustomerAuthentication.Login;
-using LoginRadiusSDK.V2.Models.UserProfile;
+
using Microsoft.AspNetCore.Mvc;
namespace dot_net_demo.Controllers
{
public class TestController : Controller
{
- LoginRadiusApiOptionalParams _apiOptionalParams = new LoginRadiusApiOptionalParams();
- public IActionResult Whoo()
- {
- LoginRadiusApiOptionalParams apiOptionalParams = new LoginRadiusApiOptionalParams();
- apiOptionalParams.VerificationUrl = "";
- apiOptionalParams.G_Recaptcha_Response = "";
+ /* LoginRadiusApiOptionalParams _apiOptionalParams = new LoginRadiusApiOptionalParams();
+ public IActionResult Whoo()
+ {
+ LoginRadiusApiOptionalParams apiOptionalParams = new LoginRadiusApiOptionalParams();
+ apiOptionalParams.VerificationUrl = "";
+ apiOptionalParams.G_Recaptcha_Response = "";
- UserNameLoginModel userNameLoginModel = new UserNameLoginModel { username = "XXX", password = "xxxx" };
- var apiresponse = new AuthenticationApi().LoginByUserName(userNameLoginModel.ConvertToJson(), apiOptionalParams);
+ UserNameLoginModel userNameLoginModel = new UserNameLoginModel { username = "XXX", password = "xxxx" };
+ var apiresponse = new AuthenticationApi().LoginByUserName(userNameLoginModel.ConvertToJson(), apiOptionalParams);
- return null;
- }
-
+ return null;
+ }*/
}
}
\ No newline at end of file
diff --git a/Samples/dot-net-demo/dot-net-demo/Models/IndexModel.cs b/Samples/dot-net-demo/dot-net-demo/Models/IndexModel.cs
index db8b653..67b9f85 100644
--- a/Samples/dot-net-demo/dot-net-demo/Models/IndexModel.cs
+++ b/Samples/dot-net-demo/dot-net-demo/Models/IndexModel.cs
@@ -1,20 +1,38 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
-
-namespace dot_net_demo.Models
+namespace dot_net_demo.Models
{
public class ForgotPasswordModel
{
public string Email { get; set; }
}
+
public class SetPasswordModel
{
public string Password { get; set; }
}
+
public class GoogleAuthenticatorModel
{
public string googleauthenticatorcode { get; set; }
}
+
+ public class EmailLoginModel
+ {
+ public string Email { get; set; }
+
+ public string Password { get; set; }
+ }
+
+ public class ResetPasswordModel
+ {
+ public string password { get; set; }
+
+ public string resettoken { get; set; }
+ }
+
+ public class ChangePasswordModel
+ {
+ public string newPassword { get; set; }
+
+ public string oldPassword { get; set; }
+ }
}
diff --git a/Samples/dot-net-demo/dot-net-demo/Program.cs b/Samples/dot-net-demo/dot-net-demo/Program.cs
index 591dd56..722603e 100644
--- a/Samples/dot-net-demo/dot-net-demo/Program.cs
+++ b/Samples/dot-net-demo/dot-net-demo/Program.cs
@@ -1,12 +1,5 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Threading.Tasks;
-using Microsoft.AspNetCore;
+using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
-using Microsoft.Extensions.Configuration;
-using Microsoft.Extensions.Logging;
namespace dot_net_demo
{
diff --git a/Samples/dot-net-demo/dot-net-demo/Views/Home/Profile.cshtml b/Samples/dot-net-demo/dot-net-demo/Views/Home/Profile.cshtml
index d3cc1fa..bfbb074 100644
--- a/Samples/dot-net-demo/dot-net-demo/Views/Home/Profile.cshtml
+++ b/Samples/dot-net-demo/dot-net-demo/Views/Home/Profile.cshtml
@@ -31,7 +31,7 @@
Profile
-
+
diff --git a/Samples/dot-net-demo/dot-net-demo/dot-net-demo.csproj b/Samples/dot-net-demo/dot-net-demo/dot-net-demo.csproj
index b412c1b..20653b3 100644
--- a/Samples/dot-net-demo/dot-net-demo/dot-net-demo.csproj
+++ b/Samples/dot-net-demo/dot-net-demo/dot-net-demo.csproj
@@ -1,4 +1,4 @@
-
+
netcoreapp2.0
@@ -17,8 +17,8 @@
-
-
+
+
diff --git a/Samples/dot-net-demo/dot-net-demo/wwwroot/js/emailVerification.js b/Samples/dot-net-demo/dot-net-demo/wwwroot/js/emailVerification.js
index b304c0e..a8338d7 100644
--- a/Samples/dot-net-demo/dot-net-demo/wwwroot/js/emailVerification.js
+++ b/Samples/dot-net-demo/dot-net-demo/wwwroot/js/emailVerification.js
@@ -31,7 +31,7 @@ let verificationFunc = function () {
}
}).done(function (ret) {
localStorage.setItem("LRTokenKey", ret.access_token);
- localStorage.setItem("lr-user-uid", ret.profile.uid);
+ localStorage.setItem("lr-user-uid", ret.Profile.Uid);
window.location.replace("/Home/Profile");
});
} else {
diff --git a/Samples/dot-net-demo/dot-net-demo/wwwroot/js/indexControl.js b/Samples/dot-net-demo/dot-net-demo/wwwroot/js/indexControl.js
index 1cf16d2..e90ee70 100644
--- a/Samples/dot-net-demo/dot-net-demo/wwwroot/js/indexControl.js
+++ b/Samples/dot-net-demo/dot-net-demo/wwwroot/js/indexControl.js
@@ -52,7 +52,7 @@ $("#btn-minimal-login").click(function () {
}
}).done(function(ret) {
localStorage.setItem("LRTokenKey", ret.access_token);
- localStorage.setItem("lr-user-uid", ret.profile.uid);
+ localStorage.setItem("lr-user-uid", ret.Profile.Uid);
window.location.replace("Home/Profile");
});
});
@@ -83,19 +83,19 @@ $("#btn-minimal-mfalogin-next").click(function () {
}).done(function (ret) {
console.log(ret);
$("#minimal-mfalogin-message").text("");
- if (ret.secondFactorAuthentication && ret.secondFactorAuthentication.secondFactorAuthenticationToken) {
- if (ret.secondFactorAuthentication.isGoogleAuthenticatorVerified === false) {
- $("#minimal-mfalogin-qrcode").append('');
+ if (ret.SecondFactorAuthentication) {
+ if (ret.SecondFactorAuthentication.IsGoogleAuthenticatorVerified === false) {
+ $("#minimal-mfalogin-qrcode").append('');
}
$("#minimal-mfalogin-next")
.html('' +
'Google Authenticator Code: ' +
'
' +
'');
- multiFactorAuthToken = ret.secondFactorAuthentication.secondFactorAuthenticationToken;
+ multiFactorAuthToken = ret.SecondFactorAuthentication.SecondFactorAuthenticationToken;
} else {
localStorage.setItem("LRTokenKey", ret.access_token);
- localStorage.setItem("lr-user-uid", ret.profile.uid);
+ localStorage.setItem("lr-user-uid", ret.Profile.Uid);
window.location.replace("Home/Profile");
}
});
@@ -118,7 +118,7 @@ $("#minimal-mfalogin-next").on('click', "#btn-minimal-mfalogin-login", function(
}).done(function (ret) {
console.log(ret);
localStorage.setItem("LRTokenKey", ret.access_token);
- localStorage.setItem("lr-user-uid", ret.profile.uid);
+ localStorage.setItem("lr-user-uid", ret.Profile.Uid);
window.location.replace("Home/Profile");
});
});
diff --git a/Samples/dot-net-demo/dot-net-demo/wwwroot/js/loginScreen.js b/Samples/dot-net-demo/dot-net-demo/wwwroot/js/loginScreen.js
index e9f2109..d0d6974 100644
--- a/Samples/dot-net-demo/dot-net-demo/wwwroot/js/loginScreen.js
+++ b/Samples/dot-net-demo/dot-net-demo/wwwroot/js/loginScreen.js
@@ -4,7 +4,7 @@ LRObject.util.ready(function() {
let options = {
redirecturl: {
- afterlogin: "http://localhost:57476/Home/Profile",
- afterreset: "http://localhost:57476/"
+ afterlogin: window.location.origin + "/Home/Profile",
+ afterreset: window.location.origin + "/"
}
}
diff --git a/Samples/dot-net-demo/dot-net-demo/wwwroot/js/profileControl.js b/Samples/dot-net-demo/dot-net-demo/wwwroot/js/profileControl.js
index 94697ec..57c8013 100644
--- a/Samples/dot-net-demo/dot-net-demo/wwwroot/js/profileControl.js
+++ b/Samples/dot-net-demo/dot-net-demo/wwwroot/js/profileControl.js
@@ -225,9 +225,9 @@ $("#btn-user-getcustomobj").click(function () {
'').appendTo("#table-customobj > tbody:last-child");
for (let i = 0; i < ret.data.length; i++) {
- $(" " + ret.data[i].id + " ").appendTo("#table-customobj > tbody:last-child");
+ $("" + ret.data[i].Id + " ").appendTo("#table-customobj > tbody:last-child");
$("", {
- text: JSON.stringify(ret.data[i].customObject)
+ text: JSON.stringify(ret.data[i].CustomObject)
}).appendTo("#table-customobj > tbody:last-child > tr:last-child");
}
});
@@ -277,7 +277,12 @@ $( "#btn-user-createrole" ).click(function() {
});
});
-$( "#btn-user-deleterole" ).click(function() {
+$("#btn-user-deleterole").click(function () {
+ if ($("#user-roles-deleterole").val() === "") {
+ $("#user-deleterole-message").text("Please input a valid Role.");
+ $("#user-deleterole-message").attr("class", "error-message");
+ return;
+ }
$.ajax({
method: "DELETE",
url: m_options.deleteRoleUrl + "?role=" + $("#user-roles-deleterole").val(),
@@ -334,17 +339,20 @@ let profileUpdate = function() {
}
}).done(function (ret) {
console.log(ret);
- if (ret.fullName === null) {
+ if (ret.FullName === null) {
$("#profile-name").html("");
} else {
- $("#profile-name").html("" + ret.fullName + "");
+ $("#profile-name").html("" + ret.FullName + "");
+ }
+ if (ret.ImageUrl != null && ret.ImageUrl != undefined && ret.ImageUrl != "") {
+ $("#profile-image").attr('src', ret.ImageUrl)
}
- $("#profile-provider").text("Provider: " + ret.provider);
- $("#profile-email").text(ret.email[0].value);
- $("#profile-lastlogin").text("Last Login Date: " + ret.lastLoginDate);
- $("#user-updateaccount-firstname").val(ret.firstName);
- $("#user-updateaccount-lastname").val(ret.lastName);
- $("#user-updateaccount-about").val(ret.about);
+ $("#profile-provider").text("Provider: " + ret.Provider);
+ $("#profile-email").text(ret.Email[0].Value);
+ $("#profile-lastlogin").text("Last Login Date: " + ret.LastLoginDate);
+ $("#user-updateaccount-firstname").val(ret.FirstName);
+ $("#user-updateaccount-lastname").val(ret.LastName);
+ $("#user-updateaccount-about").val(ret.About);
});
}
@@ -361,7 +369,7 @@ let roleUpdate = function() {
for (let i = 0; i < ret.data.length; i++) {
$(" ").appendTo("#table-allroles > tbody:last-child");
$("", {
- text: ret.data[i].name
+ text: ret.data[i].Name
}).appendTo('#table-allroles > tbody:last-child > tr:last-child');
}
});
@@ -376,11 +384,11 @@ let roleUpdate = function() {
}
}).done(function(ret) {
$('#table-userroles tr:not(:first)').remove();
- if (ret && ret.roles) {
- for (let i = 0; i < ret.roles.length; i++) {
+ if (ret && ret.Roles) {
+ for (let i = 0; i < ret.Roles.length; i++) {
$(" ").appendTo("#table-userroles > tbody:last-child");
$("", {
- text: ret.roles[i]
+ text: ret.Roles[i]
}).appendTo('#table-userroles > tbody:last-child > tr:last-child');
}
}
diff --git a/Samples/dot-net-demo/dot-net-demo/wwwroot/js/resetPassword.js b/Samples/dot-net-demo/dot-net-demo/wwwroot/js/resetPassword.js
index 053322f..71db069 100644
--- a/Samples/dot-net-demo/dot-net-demo/wwwroot/js/resetPassword.js
+++ b/Samples/dot-net-demo/dot-net-demo/wwwroot/js/resetPassword.js
@@ -1,6 +1,6 @@
const url = location.href;
const params = url.split("?")[1];
-const serverUrl = "http://localhost:4000";
+const serverUrl = "http://localhost:65151";
let paramsObj = {};
$("#btn-minimal-resetpassword").click(function () {
@@ -24,9 +24,9 @@ $("#btn-minimal-resetpassword").click(function () {
method: "PUT",
data: JSON.stringify(data),
url: m_options.resetPasswordEmailUrl,
- contentType: "application/json",
+ contentType: "application/json; charset=utf-8",
error: function(xhr) {
- $("#minimal-resetpassword-message").text(xhr.responseJSON.Description);
+ $("#minimal-resetpassword-message").text(xhr.responseJSON.value.description);
$("#minimal-resetpassword-message").attr("class", "error-message");
}
}).done(function () {
diff --git a/Source/LoginRadiusSDK.V2/Api/Account/AccountApi.cs b/Source/LoginRadiusSDK.V2/Api/Account/AccountApi.cs
new file mode 100644
index 0000000..8fa3d8c
--- /dev/null
+++ b/Source/LoginRadiusSDK.V2/Api/Account/AccountApi.cs
@@ -0,0 +1,687 @@
+//-----------------------------------------------------------------------
+//
+// Created by LoginRadius Development Team
+// Copyright 2019 LoginRadius Inc. All rights reserved.
+//
+//-----------------------------------------------------------------------
+
+using System;
+using LoginRadiusSDK.V2.Common;
+using LoginRadiusSDK.V2.Util;
+using LoginRadiusSDK.V2.Models.ResponseModels.OtherObjects;
+using LoginRadiusSDK.V2.Models.ResponseModels.UserProfile;
+using LoginRadiusSDK.V2.Models.RequestModels;
+using LoginRadiusSDK.V2.Models.ResponseModels;
+
+namespace LoginRadiusSDK.V2.Api.Account
+{
+ public class AccountApi : LoginRadiusResource
+ {
+ ///
+ /// This API is used to update the information of existing accounts in your Cloud Storage. See our Advanced API Usage section Here for more capabilities.
+ ///
+ /// Model Class containing Definition of payload for Account Update API
+ /// UID, the unified identifier for each user account
+ /// The fields parameter filters the API response so that the response only includes a specific set of fields
+ /// Boolean, pass true if you wish to update any user profile field with a NULL value, You can get the details Here
+ /// Response containing Definition for Complete profile data
+ /// 18.15
+
+ public ApiResponse UpdateAccountByUid(object payload, string uid,
+ string fields = "", bool? nullSupport = null)
+ {
+ if (payload == null)
+ {
+ throw new ArgumentException(BaseConstants.ValidationMessage, nameof(payload));
+ }
+ if (string.IsNullOrWhiteSpace(uid))
+ {
+ throw new ArgumentException(BaseConstants.ValidationMessage, nameof(uid));
+ }
+ var queryParameters = new QueryParameters
+ {
+ { "apiKey", ConfigDictionary[LRConfigConstants.LoginRadiusApiKey] },
+ { "apiSecret", ConfigDictionary[LRConfigConstants.LoginRadiusApiSecret] }
+ };
+ if (!string.IsNullOrWhiteSpace(fields))
+ {
+ queryParameters.Add("fields", fields);
+ }
+ if (nullSupport != false)
+ {
+ queryParameters.Add("nullSupport", nullSupport.ToString());
+ }
+
+ var resourcePath = $"identity/v2/manage/account/{uid}";
+
+ return ConfigureAndExecute(HttpMethod.PUT, resourcePath, queryParameters, ConvertToJson(payload));
+ }
+
+ ///
+ /// This API is used to retrieve all of the accepted Policies by the user, associated with their UID.
+ ///
+ /// UID, the unified identifier for each user account
+ /// Complete Policy History data
+ /// 15.1.1
+
+ public ApiResponse GetPrivacyPolicyHistoryByUid(string uid)
+ {
+ if (string.IsNullOrWhiteSpace(uid))
+ {
+ throw new ArgumentException(BaseConstants.ValidationMessage, nameof(uid));
+ }
+ var queryParameters = new QueryParameters
+ {
+ { "apiKey", ConfigDictionary[LRConfigConstants.LoginRadiusApiKey] },
+ { "apiSecret", ConfigDictionary[LRConfigConstants.LoginRadiusApiSecret] }
+ };
+
+ var resourcePath = $"identity/v2/manage/account/{uid}/privacypolicy/history";
+
+ return ConfigureAndExecute(HttpMethod.GET, resourcePath, queryParameters, null);
+ }
+ ///
+ /// This API is used to create an account in Cloud Storage. This API bypass the normal email verification process and manually creates the user.
In order to use this API, you need to format a JSON request body with all of the mandatory fields
+ ///
+ /// Model Class containing Definition of payload for Account Create API
+ /// The fields parameter filters the API response so that the response only includes a specific set of fields
+ /// Response containing Definition for Complete profile data
+ /// 18.1
+
+ public ApiResponse CreateAccount(AccountCreateModel accountCreateModel, string fields = "")
+ {
+ if (accountCreateModel == null)
+ {
+ throw new ArgumentException(BaseConstants.ValidationMessage, nameof(accountCreateModel));
+ }
+ var queryParameters = new QueryParameters
+ {
+ { "apiKey", ConfigDictionary[LRConfigConstants.LoginRadiusApiKey] },
+ { "apiSecret", ConfigDictionary[LRConfigConstants.LoginRadiusApiSecret] }
+ };
+ if (!string.IsNullOrWhiteSpace(fields))
+ {
+ queryParameters.Add("fields", fields);
+ }
+
+ var resourcePath = "identity/v2/manage/account";
+
+ return ConfigureAndExecute(HttpMethod.POST, resourcePath, queryParameters, ConvertToJson(accountCreateModel));
+ }
+ ///
+ /// This API is used to retrieve all of the profile data, associated with the specified account by email in Cloud Storage.
+ ///
+ /// Email of the user
+ /// The fields parameter filters the API response so that the response only includes a specific set of fields
+ /// Response containing Definition for Complete profile data
+ /// 18.2
+
+ public ApiResponse GetAccountProfileByEmail(string email, string fields = "")
+ {
+ if (string.IsNullOrWhiteSpace(email))
+ {
+ throw new ArgumentException(BaseConstants.ValidationMessage, nameof(email));
+ }
+ var queryParameters = new QueryParameters
+ {
+ { "apiKey", ConfigDictionary[LRConfigConstants.LoginRadiusApiKey] },
+ { "apiSecret", ConfigDictionary[LRConfigConstants.LoginRadiusApiSecret] },
+ { "email", email }
+ };
+ if (!string.IsNullOrWhiteSpace(fields))
+ {
+ queryParameters.Add("fields", fields);
+ }
+
+ var resourcePath = "identity/v2/manage/account";
+
+ return ConfigureAndExecute(HttpMethod.GET, resourcePath, queryParameters, null);
+ }
+ ///
+ /// This API is used to retrieve all of the profile data associated with the specified account by user name in Cloud Storage.
+ ///
+ /// UserName of the user
+ /// The fields parameter filters the API response so that the response only includes a specific set of fields
+ /// Response containing Definition for Complete profile data
+ /// 18.3
+
+ public ApiResponse GetAccountProfileByUserName(string userName, string fields = "")
+ {
+ if (string.IsNullOrWhiteSpace(userName))
+ {
+ throw new ArgumentException(BaseConstants.ValidationMessage, nameof(userName));
+ }
+ var queryParameters = new QueryParameters
+ {
+ { "apiKey", ConfigDictionary[LRConfigConstants.LoginRadiusApiKey] },
+ { "apiSecret", ConfigDictionary[LRConfigConstants.LoginRadiusApiSecret] },
+ { "userName", userName }
+ };
+ if (!string.IsNullOrWhiteSpace(fields))
+ {
+ queryParameters.Add("fields", fields);
+ }
+
+ var resourcePath = "identity/v2/manage/account";
+
+ return ConfigureAndExecute(HttpMethod.GET, resourcePath, queryParameters, null);
+ }
+ ///
+ /// This API is used to retrieve all of the profile data, associated with the account by phone number in Cloud Storage.
+ ///
+ /// The Registered Phone Number
+ /// The fields parameter filters the API response so that the response only includes a specific set of fields
+ /// Response containing Definition for Complete profile data
+ /// 18.4
+
+ public ApiResponse GetAccountProfileByPhone(string phone, string fields = "")
+ {
+ if (string.IsNullOrWhiteSpace(phone))
+ {
+ throw new ArgumentException(BaseConstants.ValidationMessage, nameof(phone));
+ }
+ var queryParameters = new QueryParameters
+ {
+ { "apiKey", ConfigDictionary[LRConfigConstants.LoginRadiusApiKey] },
+ { "apiSecret", ConfigDictionary[LRConfigConstants.LoginRadiusApiSecret] },
+ { "phone", phone }
+ };
+ if (!string.IsNullOrWhiteSpace(fields))
+ {
+ queryParameters.Add("fields", fields);
+ }
+
+ var resourcePath = "identity/v2/manage/account";
+
+ return ConfigureAndExecute(HttpMethod.GET, resourcePath, queryParameters, null);
+ }
+ ///
+ /// This API is used to retrieve all of the profile data, associated with the account by uid in Cloud Storage.
+ ///
+ /// UID, the unified identifier for each user account
+ /// The fields parameter filters the API response so that the response only includes a specific set of fields
+ /// Response containing Definition for Complete profile data
+ /// 18.5
+
+ public ApiResponse GetAccountProfileByUid(string uid, string fields = "")
+ {
+ if (string.IsNullOrWhiteSpace(uid))
+ {
+ throw new ArgumentException(BaseConstants.ValidationMessage, nameof(uid));
+ }
+ var queryParameters = new QueryParameters
+ {
+ { "apiKey", ConfigDictionary[LRConfigConstants.LoginRadiusApiKey] },
+ { "apiSecret", ConfigDictionary[LRConfigConstants.LoginRadiusApiSecret] }
+ };
+ if (!string.IsNullOrWhiteSpace(fields))
+ {
+ queryParameters.Add("fields", fields);
+ }
+
+ var resourcePath = $"identity/v2/manage/account/{uid}";
+
+ return ConfigureAndExecute(HttpMethod.GET, resourcePath, queryParameters, null);
+ }
+ ///
+ /// This API is used to update the information of existing accounts in your Cloud Storage. See our Advanced API Usage section Here for more capabilities.
+ ///
+ /// Model Class containing Definition of payload for Account Update API
+ /// UID, the unified identifier for each user account
+ /// The fields parameter filters the API response so that the response only includes a specific set of fields
+ /// Response containing Definition for Complete profile data
+ /// 18.15
+
+ public ApiResponse UpdateAccountByUid(AccountUserProfileUpdateModel accountUserProfileUpdateModel, string uid,
+ string fields = "")
+ {
+ if (accountUserProfileUpdateModel == null)
+ {
+ throw new ArgumentException(BaseConstants.ValidationMessage, nameof(accountUserProfileUpdateModel));
+ }
+ if (string.IsNullOrWhiteSpace(uid))
+ {
+ throw new ArgumentException(BaseConstants.ValidationMessage, nameof(uid));
+ }
+ var queryParameters = new QueryParameters
+ {
+ { "apiKey", ConfigDictionary[LRConfigConstants.LoginRadiusApiKey] },
+ { "apiSecret", ConfigDictionary[LRConfigConstants.LoginRadiusApiSecret] }
+ };
+ if (!string.IsNullOrWhiteSpace(fields))
+ {
+ queryParameters.Add("fields", fields);
+ }
+
+ var resourcePath = $"identity/v2/manage/account/{uid}";
+
+ return ConfigureAndExecute(HttpMethod.PUT, resourcePath, queryParameters, ConvertToJson(accountUserProfileUpdateModel));
+ }
+ ///
+ /// This API is used to update the PhoneId by using the Uid's. Admin can update the PhoneId's for both the verified and unverified profiles. It will directly replace the PhoneId and bypass the OTP verification process.
+ ///
+ /// Phone number
+ /// UID, the unified identifier for each user account
+ /// The fields parameter filters the API response so that the response only includes a specific set of fields
+ /// Response containing Definition for Complete profile data
+ /// 18.16
+
+ public ApiResponse UpdatePhoneIDByUid(string phone, string uid,
+ string fields = "")
+ {
+ if (string.IsNullOrWhiteSpace(phone))
+ {
+ throw new ArgumentException(BaseConstants.ValidationMessage, nameof(phone));
+ }
+ if (string.IsNullOrWhiteSpace(uid))
+ {
+ throw new ArgumentException(BaseConstants.ValidationMessage, nameof(uid));
+ }
+ var queryParameters = new QueryParameters
+ {
+ { "apiKey", ConfigDictionary[LRConfigConstants.LoginRadiusApiKey] },
+ { "apiSecret", ConfigDictionary[LRConfigConstants.LoginRadiusApiSecret] }
+ };
+ if (!string.IsNullOrWhiteSpace(fields))
+ {
+ queryParameters.Add("fields", fields);
+ }
+
+ var bodyParameters = new BodyParameters
+ {
+ { "phone", phone }
+ };
+
+ var resourcePath = $"identity/v2/manage/account/{uid}/phoneid";
+
+ return ConfigureAndExecute(HttpMethod.PUT, resourcePath, queryParameters, ConvertToJson(bodyParameters));
+ }
+ ///
+ /// This API use to retrive the hashed password of a specified account in Cloud Storage.
+ ///
+ /// UID, the unified identifier for each user account
+ /// Response containing Definition for Complete PasswordHash data
+ /// 18.17
+
+ public ApiResponse GetAccountPasswordHashByUid(string uid)
+ {
+ if (string.IsNullOrWhiteSpace(uid))
+ {
+ throw new ArgumentException(BaseConstants.ValidationMessage, nameof(uid));
+ }
+ var queryParameters = new QueryParameters
+ {
+ { "apiKey", ConfigDictionary[LRConfigConstants.LoginRadiusApiKey] },
+ { "apiSecret", ConfigDictionary[LRConfigConstants.LoginRadiusApiSecret] }
+ };
+
+ var resourcePath = $"identity/v2/manage/account/{uid}/password";
+
+ return ConfigureAndExecute(HttpMethod.GET, resourcePath, queryParameters, null);
+ }
+ ///
+ /// This API is used to set the password of an account in Cloud Storage.
+ ///
+ /// New password
+ /// UID, the unified identifier for each user account
+ /// Response containing Definition for Complete PasswordHash data
+ /// 18.18
+
+ public ApiResponse SetAccountPasswordByUid(string password, string uid)
+ {
+ if (string.IsNullOrWhiteSpace(password))
+ {
+ throw new ArgumentException(BaseConstants.ValidationMessage, nameof(password));
+ }
+ if (string.IsNullOrWhiteSpace(uid))
+ {
+ throw new ArgumentException(BaseConstants.ValidationMessage, nameof(uid));
+ }
+ var queryParameters = new QueryParameters
+ {
+ { "apiKey", ConfigDictionary[LRConfigConstants.LoginRadiusApiKey] },
+ { "apiSecret", ConfigDictionary[LRConfigConstants.LoginRadiusApiSecret] }
+ };
+
+ var bodyParameters = new BodyParameters
+ {
+ { "password", password }
+ };
+
+ var resourcePath = $"identity/v2/manage/account/{uid}/password";
+
+ return ConfigureAndExecute(HttpMethod.PUT, resourcePath, queryParameters, ConvertToJson(bodyParameters));
+ }
+ ///
+ /// This API deletes the Users account and allows them to re-register for a new account.
+ ///
+ /// UID, the unified identifier for each user account
+ /// Response containing Definition of Delete Request
+ /// 18.19
+
+ public ApiResponse DeleteAccountByUid(string uid)
+ {
+ if (string.IsNullOrWhiteSpace(uid))
+ {
+ throw new ArgumentException(BaseConstants.ValidationMessage, nameof(uid));
+ }
+ var queryParameters = new QueryParameters
+ {
+ { "apiKey", ConfigDictionary[LRConfigConstants.LoginRadiusApiKey] },
+ { "apiSecret", ConfigDictionary[LRConfigConstants.LoginRadiusApiSecret] }
+ };
+
+ var resourcePath = $"identity/v2/manage/account/{uid}";
+
+ return ConfigureAndExecute(HttpMethod.DELETE, resourcePath, queryParameters, null);
+ }
+ ///
+ /// This API is used to invalidate the Email Verification status on an account.
+ ///
+ /// UID, the unified identifier for each user account
+ /// Email template name
+ /// Email verification url
+ /// Response containing Definition of Complete Validation data
+ /// 18.20
+
+ public ApiResponse InvalidateAccountEmailVerification(string uid, string emailTemplate = "",
+ string verificationUrl = "")
+ {
+ if (string.IsNullOrWhiteSpace(uid))
+ {
+ throw new ArgumentException(BaseConstants.ValidationMessage, nameof(uid));
+ }
+ var queryParameters = new QueryParameters
+ {
+ { "apiKey", ConfigDictionary[LRConfigConstants.LoginRadiusApiKey] },
+ { "apiSecret", ConfigDictionary[LRConfigConstants.LoginRadiusApiSecret] }
+ };
+ if (!string.IsNullOrWhiteSpace(emailTemplate))
+ {
+ queryParameters.Add("emailTemplate", emailTemplate);
+ }
+ if (!string.IsNullOrWhiteSpace(verificationUrl))
+ {
+ queryParameters.Add("verificationUrl", verificationUrl);
+ }
+
+ var resourcePath = $"identity/v2/manage/account/{uid}/invalidateemail";
+
+ return ConfigureAndExecute(HttpMethod.PUT, resourcePath, queryParameters, null);
+ }
+ ///
+ /// This API Returns a Forgot Password Token it can also be used to send a Forgot Password email to the customer. Note: If you have the UserName workflow enabled, you may replace the 'email' parameter with 'username' in the body.
+ ///
+ /// user's email
+ /// Email template name
+ /// Url to which user should get re-directed to for resetting the password
+ /// If set to true, the API will also send a Forgot Password email to the customer, bypassing any Bot Protection challenges that they are faced with.
+ /// Response containing Definition of Complete Forgot Password data
+ /// 18.22
+
+ public ApiResponse GetForgotPasswordToken(string email, string emailTemplate = null,
+ string resetPasswordUrl = null, bool sendEmail = false)
+ {
+ if (string.IsNullOrWhiteSpace(email))
+ {
+ throw new ArgumentException(BaseConstants.ValidationMessage, nameof(email));
+ }
+ var queryParameters = new QueryParameters
+ {
+ { "apiKey", ConfigDictionary[LRConfigConstants.LoginRadiusApiKey] },
+ { "apiSecret", ConfigDictionary[LRConfigConstants.LoginRadiusApiSecret] }
+ };
+ if (!string.IsNullOrWhiteSpace(emailTemplate))
+ {
+ queryParameters.Add("emailTemplate", emailTemplate);
+ }
+ if (!string.IsNullOrWhiteSpace(resetPasswordUrl))
+ {
+ queryParameters.Add("resetPasswordUrl", resetPasswordUrl);
+ }
+ if (sendEmail != false)
+ {
+ queryParameters.Add("sendEmail", sendEmail.ToString());
+ }
+
+ var bodyParameters = new BodyParameters
+ {
+ { "email", email }
+ };
+
+ var resourcePath = "identity/v2/manage/account/forgot/token";
+
+ return ConfigureAndExecute(HttpMethod.POST, resourcePath, queryParameters, ConvertToJson(bodyParameters));
+ }
+ ///
+ /// This API Returns an Email Verification token.
+ ///
+ /// user's email
+ /// Response containing Definition of Complete Verification data
+ /// 18.23
+
+ public ApiResponse GetEmailVerificationToken(string email)
+ {
+ if (string.IsNullOrWhiteSpace(email))
+ {
+ throw new ArgumentException(BaseConstants.ValidationMessage, nameof(email));
+ }
+ var queryParameters = new QueryParameters
+ {
+ { "apiKey", ConfigDictionary[LRConfigConstants.LoginRadiusApiKey] },
+ { "apiSecret", ConfigDictionary[LRConfigConstants.LoginRadiusApiSecret] }
+ };
+
+ var bodyParameters = new BodyParameters
+ {
+ { "email", email }
+ };
+
+ var resourcePath = "identity/v2/manage/account/verify/token";
+
+ return ConfigureAndExecute(HttpMethod.POST, resourcePath, queryParameters, ConvertToJson(bodyParameters));
+ }
+ ///
+ /// The API is used to get LoginRadius access token based on UID.
+ ///
+ /// UID, the unified identifier for each user account
+ /// Response containing Definition of Complete Token data
+ /// 18.24
+
+ public ApiResponse GetAccessTokenByUid(string uid)
+ {
+ if (string.IsNullOrWhiteSpace(uid))
+ {
+ throw new ArgumentException(BaseConstants.ValidationMessage, nameof(uid));
+ }
+ var queryParameters = new QueryParameters
+ {
+ { "apiKey", ConfigDictionary[LRConfigConstants.LoginRadiusApiKey] },
+ { "apiSecret", ConfigDictionary[LRConfigConstants.LoginRadiusApiSecret] },
+ { "uid", uid }
+ };
+
+ var resourcePath = "identity/v2/manage/account/access_token";
+
+ return ConfigureAndExecute(HttpMethod.GET, resourcePath, queryParameters, null);
+ }
+ ///
+ /// This API Allows you to reset the phone no verification of an end user’s account.
+ ///
+ /// UID, the unified identifier for each user account
+ /// SMS Template name
+ /// Response containing Definition of Complete Validation data
+ /// 18.27
+
+ public ApiResponse ResetPhoneIDVerificationByUid(string uid, string smsTemplate = "")
+ {
+ if (string.IsNullOrWhiteSpace(uid))
+ {
+ throw new ArgumentException(BaseConstants.ValidationMessage, nameof(uid));
+ }
+ var queryParameters = new QueryParameters
+ {
+ { "apiKey", ConfigDictionary[LRConfigConstants.LoginRadiusApiKey] },
+ { "apiSecret", ConfigDictionary[LRConfigConstants.LoginRadiusApiSecret] }
+ };
+ if (!string.IsNullOrWhiteSpace(smsTemplate))
+ {
+ queryParameters.Add("smsTemplate", smsTemplate);
+ }
+
+ var resourcePath = $"identity/v2/manage/account/{uid}/invalidatephone";
+
+ return ConfigureAndExecute(HttpMethod.PUT, resourcePath, queryParameters, null);
+ }
+ ///
+ /// This API is used to add/upsert another emails in account profile by different-different email types. If the email type is same then it will simply update the existing email, otherwise it will add a new email in Email array.
+ ///
+ /// Model Class containing Definition of payload for UpsertEmail Property
+ /// UID, the unified identifier for each user account
+ /// The fields parameter filters the API response so that the response only includes a specific set of fields
+ /// Response containing Definition for Complete profile data
+ /// 18.29
+
+ public ApiResponse UpsertEmail(UpsertEmailModel upsertEmailModel, string uid,
+ string fields = "")
+ {
+ if (upsertEmailModel == null)
+ {
+ throw new ArgumentException(BaseConstants.ValidationMessage, nameof(upsertEmailModel));
+ }
+ if (string.IsNullOrWhiteSpace(uid))
+ {
+ throw new ArgumentException(BaseConstants.ValidationMessage, nameof(uid));
+ }
+ var queryParameters = new QueryParameters
+ {
+ { "apiKey", ConfigDictionary[LRConfigConstants.LoginRadiusApiKey] },
+ { "apiSecret", ConfigDictionary[LRConfigConstants.LoginRadiusApiSecret] }
+ };
+ if (!string.IsNullOrWhiteSpace(fields))
+ {
+ queryParameters.Add("fields", fields);
+ }
+
+ var resourcePath = $"identity/v2/manage/account/{uid}/email";
+
+ return ConfigureAndExecute(HttpMethod.PUT, resourcePath, queryParameters, ConvertToJson(upsertEmailModel));
+ }
+ ///
+ /// Use this API to Remove emails from a user Account
+ ///
+ /// user's email
+ /// UID, the unified identifier for each user account
+ /// The fields parameter filters the API response so that the response only includes a specific set of fields
+ /// Response containing Definition for Complete profile data
+ /// 18.30
+
+ public ApiResponse RemoveEmail(string email, string uid,
+ string fields = "")
+ {
+ if (string.IsNullOrWhiteSpace(email))
+ {
+ throw new ArgumentException(BaseConstants.ValidationMessage, nameof(email));
+ }
+ if (string.IsNullOrWhiteSpace(uid))
+ {
+ throw new ArgumentException(BaseConstants.ValidationMessage, nameof(uid));
+ }
+ var queryParameters = new QueryParameters
+ {
+ { "apiKey", ConfigDictionary[LRConfigConstants.LoginRadiusApiKey] },
+ { "apiSecret", ConfigDictionary[LRConfigConstants.LoginRadiusApiSecret] }
+ };
+ if (!string.IsNullOrWhiteSpace(fields))
+ {
+ queryParameters.Add("fields", fields);
+ }
+
+ var bodyParameters = new BodyParameters
+ {
+ { "email", email }
+ };
+
+ var resourcePath = $"identity/v2/manage/account/{uid}/email";
+
+ return ConfigureAndExecute(HttpMethod.DELETE, resourcePath, queryParameters, ConvertToJson(bodyParameters));
+ }
+ ///
+ /// This API is used to refresh an access_token via it's associated refresh_token.
+ ///
+ /// LoginRadius refresh_token
+ /// Response containing Definition of Complete Token data
+ /// 18.31
+
+ public ApiResponse RefreshAccessTokenByRefreshToken(string refreshToken)
+ {
+ if (string.IsNullOrWhiteSpace(refreshToken))
+ {
+ throw new ArgumentException(BaseConstants.ValidationMessage, nameof(refreshToken));
+ }
+ var queryParameters = new QueryParameters
+ {
+ { "apiKey", ConfigDictionary[LRConfigConstants.LoginRadiusApiKey] },
+ { "apiSecret", ConfigDictionary[LRConfigConstants.LoginRadiusApiSecret] },
+ { "refresh_Token", refreshToken }
+ };
+
+ var resourcePath = "identity/v2/manage/account/access_token/refresh";
+
+ return ConfigureAndExecute(HttpMethod.GET, resourcePath, queryParameters, null);
+ }
+ ///
+ /// The Revoke Refresh Access Token API is used to revoke a refresh token or the Provider Access Token, revoking an existing refresh token will invalidate the refresh token but the associated access token will work until the expiry.
+ ///
+ /// LoginRadius refresh_token
+ /// Response containing Definition of Delete Request
+ /// 18.32
+
+ public ApiResponse RevokeRefreshToken(string refreshToken)
+ {
+ if (string.IsNullOrWhiteSpace(refreshToken))
+ {
+ throw new ArgumentException(BaseConstants.ValidationMessage, nameof(refreshToken));
+ }
+ var queryParameters = new QueryParameters
+ {
+ { "apiKey", ConfigDictionary[LRConfigConstants.LoginRadiusApiKey] },
+ { "apiSecret", ConfigDictionary[LRConfigConstants.LoginRadiusApiSecret] },
+ { "refresh_Token", refreshToken }
+ };
+
+ var resourcePath = "identity/v2/manage/account/access_token/refresh/revoke";
+
+ return ConfigureAndExecute(HttpMethod.GET, resourcePath, queryParameters, null);
+ }
+ ///
+ /// Note: This is intended for specific workflows where an email may be associated to multiple UIDs. This API is used to retrieve all of the identities (UID and Profiles), associated with a specified email in Cloud Storage.
+ ///
+ /// Email of the user
+ /// The fields parameter filters the API response so that the response only includes a specific set of fields
+ /// Complete user Identity data
+ /// 18.35
+
+ public ApiResponse> GetAccountIdentitiesByEmail(string email, string fields = "")
+ {
+ if (string.IsNullOrWhiteSpace(email))
+ {
+ throw new ArgumentException(BaseConstants.ValidationMessage, nameof(email));
+ }
+ var queryParameters = new QueryParameters
+ {
+ { "apiKey", ConfigDictionary[LRConfigConstants.LoginRadiusApiKey] },
+ { "apiSecret", ConfigDictionary[LRConfigConstants.LoginRadiusApiSecret] },
+ { "email", email }
+ };
+ if (!string.IsNullOrWhiteSpace(fields))
+ {
+ queryParameters.Add("fields", fields);
+ }
+
+ var resourcePath = "identity/v2/manage/account/identities";
+
+ return ConfigureAndExecute>(HttpMethod.GET, resourcePath, queryParameters, null);
+ }
+ }
+}
\ No newline at end of file
diff --git a/Source/LoginRadiusSDK.V2/Api/Account/RoleApi.cs b/Source/LoginRadiusSDK.V2/Api/Account/RoleApi.cs
new file mode 100644
index 0000000..f7c7d4c
--- /dev/null
+++ b/Source/LoginRadiusSDK.V2/Api/Account/RoleApi.cs
@@ -0,0 +1,390 @@
+//-----------------------------------------------------------------------
+//
+// Created by LoginRadius Development Team
+// Copyright 2019 LoginRadius Inc. All rights reserved.
+//
+//-----------------------------------------------------------------------
+
+using System;
+using LoginRadiusSDK.V2.Common;
+using LoginRadiusSDK.V2.Util;
+using LoginRadiusSDK.V2.Models.ResponseModels.OtherObjects;
+using LoginRadiusSDK.V2.Models.RequestModels;
+using LoginRadiusSDK.V2.Models.ResponseModels;
+using LoginRadiusSDK.V2.Models.ResponseModels.UserProfile.Objects;
+
+namespace LoginRadiusSDK.V2.Api.Account
+{
+ public class RoleApi : LoginRadiusResource
+ {
+ ///
+ /// API is used to retrieve all the assigned roles of a particular User.
+ ///
+ /// UID, the unified identifier for each user account
+ /// Response containing Definition of Complete Roles data
+ /// 18.6
+
+ public ApiResponse GetRolesByUid(string uid)
+ {
+ if (string.IsNullOrWhiteSpace(uid))
+ {
+ throw new ArgumentException(BaseConstants.ValidationMessage, nameof(uid));
+ }
+ var queryParameters = new QueryParameters
+ {
+ { "apiKey", ConfigDictionary[LRConfigConstants.LoginRadiusApiKey] },
+ { "apiSecret", ConfigDictionary[LRConfigConstants.LoginRadiusApiSecret] }
+ };
+
+ var resourcePath = $"identity/v2/manage/account/{uid}/role";
+
+ return ConfigureAndExecute(HttpMethod.GET, resourcePath, queryParameters, null);
+ }
+ ///
+ /// This API is used to assign your desired roles to a given user.
+ ///
+ /// Model Class containing Definition of payload for Create Role API
+ /// UID, the unified identifier for each user account
+ /// Response containing Definition of Complete Roles data
+ /// 18.7
+
+ public ApiResponse AssignRolesByUid(LoginRadiusSDK.V2.Models.RequestModels.AccountRolesModel accountRolesModel, string uid)
+ {
+ if (accountRolesModel == null)
+ {
+ throw new ArgumentException(BaseConstants.ValidationMessage, nameof(accountRolesModel));
+ }
+ if (string.IsNullOrWhiteSpace(uid))
+ {
+ throw new ArgumentException(BaseConstants.ValidationMessage, nameof(uid));
+ }
+ var queryParameters = new QueryParameters
+ {
+ { "apiKey", ConfigDictionary[LRConfigConstants.LoginRadiusApiKey] },
+ { "apiSecret", ConfigDictionary[LRConfigConstants.LoginRadiusApiSecret] }
+ };
+
+ var resourcePath = $"identity/v2/manage/account/{uid}/role";
+
+ return ConfigureAndExecute(HttpMethod.PUT, resourcePath, queryParameters, ConvertToJson(accountRolesModel));
+ }
+ ///
+ /// This API is used to unassign roles from a user.
+ ///
+ /// Model Class containing Definition of payload for Create Role API
+ /// UID, the unified identifier for each user account
+ /// Response containing Definition of Delete Request
+ /// 18.8
+
+ public ApiResponse UnassignRolesByUid(LoginRadiusSDK.V2.Models.RequestModels.AccountRolesModel accountRolesModel, string uid)
+ {
+ if (accountRolesModel == null)
+ {
+ throw new ArgumentException(BaseConstants.ValidationMessage, nameof(accountRolesModel));
+ }
+ if (string.IsNullOrWhiteSpace(uid))
+ {
+ throw new ArgumentException(BaseConstants.ValidationMessage, nameof(uid));
+ }
+ var queryParameters = new QueryParameters
+ {
+ { "apiKey", ConfigDictionary[LRConfigConstants.LoginRadiusApiKey] },
+ { "apiSecret", ConfigDictionary[LRConfigConstants.LoginRadiusApiSecret] }
+ };
+
+ var resourcePath = $"identity/v2/manage/account/{uid}/role";
+
+ return ConfigureAndExecute(HttpMethod.DELETE, resourcePath, queryParameters, ConvertToJson(accountRolesModel));
+ }
+ ///
+ /// This API Gets the contexts that have been configured and the associated roles and permissions.
+ ///
+ /// UID, the unified identifier for each user account
+ /// Complete user RoleContext data
+ /// 18.9
+
+ public ApiResponse> GetRoleContextByUid(string uid)
+ {
+ if (string.IsNullOrWhiteSpace(uid))
+ {
+ throw new ArgumentException(BaseConstants.ValidationMessage, nameof(uid));
+ }
+ var queryParameters = new QueryParameters
+ {
+ { "apiKey", ConfigDictionary[LRConfigConstants.LoginRadiusApiKey] },
+ { "apiSecret", ConfigDictionary[LRConfigConstants.LoginRadiusApiSecret] }
+ };
+
+ var resourcePath = $"identity/v2/manage/account/{uid}/rolecontext";
+
+ return ConfigureAndExecute>(HttpMethod.GET, resourcePath, queryParameters, null);
+ }
+ ///
+ /// The API is used to retrieve role context by the context name.
+ ///
+ /// Name of context
+ /// Complete user RoleContext data
+ /// 18.10
+
+ public ApiResponse> GetRoleContextByContextName(string contextName)
+ {
+ if (string.IsNullOrWhiteSpace(contextName))
+ {
+ throw new ArgumentException(BaseConstants.ValidationMessage, nameof(contextName));
+ }
+ var queryParameters = new QueryParameters
+ {
+ { "apiKey", ConfigDictionary[LRConfigConstants.LoginRadiusApiKey] },
+ { "apiSecret", ConfigDictionary[LRConfigConstants.LoginRadiusApiSecret] }
+ };
+
+ var resourcePath = $"identity/v2/manage/account/rolecontext/{contextName}";
+
+ return ConfigureAndExecute>(HttpMethod.GET, resourcePath, queryParameters, null);
+ }
+ ///
+ /// This API creates a Context with a set of Roles
+ ///
+ /// Model Class containing Definition of RoleContext payload
+ /// UID, the unified identifier for each user account
+ /// Complete user RoleContext data
+ /// 18.11
+
+ public ApiResponse> UpdateRoleContextByUid(AccountRoleContextModel accountRoleContextModel, string uid)
+ {
+ if (accountRoleContextModel == null)
+ {
+ throw new ArgumentException(BaseConstants.ValidationMessage, nameof(accountRoleContextModel));
+ }
+ if (string.IsNullOrWhiteSpace(uid))
+ {
+ throw new ArgumentException(BaseConstants.ValidationMessage, nameof(uid));
+ }
+ var queryParameters = new QueryParameters
+ {
+ { "apiKey", ConfigDictionary[LRConfigConstants.LoginRadiusApiKey] },
+ { "apiSecret", ConfigDictionary[LRConfigConstants.LoginRadiusApiSecret] }
+ };
+
+ var resourcePath = $"identity/v2/manage/account/{uid}/rolecontext";
+
+ return ConfigureAndExecute>(HttpMethod.PUT, resourcePath, queryParameters, ConvertToJson(accountRoleContextModel));
+ }
+ ///
+ /// This API Deletes the specified Role Context
+ ///
+ /// Name of context
+ /// UID, the unified identifier for each user account
+ /// Response containing Definition of Delete Request
+ /// 18.12
+
+ public ApiResponse DeleteRoleContextByUid(string contextName, string uid)
+ {
+ if (string.IsNullOrWhiteSpace(contextName))
+ {
+ throw new ArgumentException(BaseConstants.ValidationMessage, nameof(contextName));
+ }
+ if (string.IsNullOrWhiteSpace(uid))
+ {
+ throw new ArgumentException(BaseConstants.ValidationMessage, nameof(uid));
+ }
+ var queryParameters = new QueryParameters
+ {
+ { "apiKey", ConfigDictionary[LRConfigConstants.LoginRadiusApiKey] },
+ { "apiSecret", ConfigDictionary[LRConfigConstants.LoginRadiusApiSecret] }
+ };
+
+ var resourcePath = $"identity/v2/manage/account/{uid}/rolecontext/{contextName}";
+
+ return ConfigureAndExecute(HttpMethod.DELETE, resourcePath, queryParameters, null);
+ }
+ ///
+ /// This API Deletes the specified Role from a Context.
+ ///
+ /// Name of context
+ /// Model Class containing Definition of payload for RoleContextRemoveRole API
+ /// UID, the unified identifier for each user account
+ /// Response containing Definition of Delete Request
+ /// 18.13
+
+ public ApiResponse DeleteRolesFromRoleContextByUid(string contextName, RoleContextRemoveRoleModel roleContextRemoveRoleModel,
+ string uid)
+ {
+ if (string.IsNullOrWhiteSpace(contextName))
+ {
+ throw new ArgumentException(BaseConstants.ValidationMessage, nameof(contextName));
+ }
+ if (roleContextRemoveRoleModel == null)
+ {
+ throw new ArgumentException(BaseConstants.ValidationMessage, nameof(roleContextRemoveRoleModel));
+ }
+ if (string.IsNullOrWhiteSpace(uid))
+ {
+ throw new ArgumentException(BaseConstants.ValidationMessage, nameof(uid));
+ }
+ var queryParameters = new QueryParameters
+ {
+ { "apiKey", ConfigDictionary[LRConfigConstants.LoginRadiusApiKey] },
+ { "apiSecret", ConfigDictionary[LRConfigConstants.LoginRadiusApiSecret] }
+ };
+
+ var resourcePath = $"identity/v2/manage/account/{uid}/rolecontext/{contextName}/role";
+
+ return ConfigureAndExecute(HttpMethod.DELETE, resourcePath, queryParameters, ConvertToJson(roleContextRemoveRoleModel));
+ }
+ ///
+ /// This API Deletes Additional Permissions from Context.
+ ///
+ /// Name of context
+ /// Model Class containing Definition of payload for RoleContextAdditionalPermissionRemoveRole API
+ /// UID, the unified identifier for each user account
+ /// Response containing Definition of Delete Request
+ /// 18.14
+
+ public ApiResponse DeleteAdditionalPermissionFromRoleContextByUid(string contextName, RoleContextAdditionalPermissionRemoveRoleModel roleContextAdditionalPermissionRemoveRoleModel,
+ string uid)
+ {
+ if (string.IsNullOrWhiteSpace(contextName))
+ {
+ throw new ArgumentException(BaseConstants.ValidationMessage, nameof(contextName));
+ }
+ if (roleContextAdditionalPermissionRemoveRoleModel == null)
+ {
+ throw new ArgumentException(BaseConstants.ValidationMessage, nameof(roleContextAdditionalPermissionRemoveRoleModel));
+ }
+ if (string.IsNullOrWhiteSpace(uid))
+ {
+ throw new ArgumentException(BaseConstants.ValidationMessage, nameof(uid));
+ }
+ var queryParameters = new QueryParameters
+ {
+ { "apiKey", ConfigDictionary[LRConfigConstants.LoginRadiusApiKey] },
+ { "apiSecret", ConfigDictionary[LRConfigConstants.LoginRadiusApiSecret] }
+ };
+
+ var resourcePath = $"identity/v2/manage/account/{uid}/rolecontext/{contextName}/additionalpermission";
+
+ return ConfigureAndExecute(HttpMethod.DELETE, resourcePath, queryParameters, ConvertToJson(roleContextAdditionalPermissionRemoveRoleModel));
+ }
+ ///
+ /// This API retrieves the complete list of created roles with permissions of your app.
+ ///
+ /// Complete user Roles List data
+ /// 41.1
+
+ public ApiResponse> GetRolesList()
+ {
+ var queryParameters = new QueryParameters
+ {
+ { "apiKey", ConfigDictionary[LRConfigConstants.LoginRadiusApiKey] },
+ { "apiSecret", ConfigDictionary[LRConfigConstants.LoginRadiusApiSecret] }
+ };
+
+ var resourcePath = "identity/v2/manage/role";
+
+ return ConfigureAndExecute>(HttpMethod.GET, resourcePath, queryParameters, null);
+ }
+ ///
+ /// This API creates a role with permissions.
+ ///
+ /// Model Class containing Definition of payload for Roles API
+ /// Complete user Roles data
+ /// 41.2
+
+ public ApiResponse> CreateRoles(RolesModel rolesModel)
+ {
+ if (rolesModel == null)
+ {
+ throw new ArgumentException(BaseConstants.ValidationMessage, nameof(rolesModel));
+ }
+ var queryParameters = new QueryParameters
+ {
+ { "apiKey", ConfigDictionary[LRConfigConstants.LoginRadiusApiKey] },
+ { "apiSecret", ConfigDictionary[LRConfigConstants.LoginRadiusApiSecret] }
+ };
+
+ var resourcePath = "identity/v2/manage/role";
+
+ return ConfigureAndExecute>(HttpMethod.POST, resourcePath, queryParameters, ConvertToJson(rolesModel));
+ }
+ ///
+ /// This API is used to delete the role.
+ ///
+ /// Created RoleName
+ /// Response containing Definition of Delete Request
+ /// 41.3
+
+ public ApiResponse DeleteRole(string role)
+ {
+ if (string.IsNullOrWhiteSpace(role))
+ {
+ throw new ArgumentException(BaseConstants.ValidationMessage, nameof(role));
+ }
+ var queryParameters = new QueryParameters
+ {
+ { "apiKey", ConfigDictionary[LRConfigConstants.LoginRadiusApiKey] },
+ { "apiSecret", ConfigDictionary[LRConfigConstants.LoginRadiusApiSecret] }
+ };
+
+ var resourcePath = $"identity/v2/manage/role/{role}";
+
+ return ConfigureAndExecute(HttpMethod.DELETE, resourcePath, queryParameters, null);
+ }
+ ///
+ /// This API is used to add permissions to a given role.
+ ///
+ /// Model Class containing Definition for PermissionsModel Property
+ /// Created RoleName
+ /// Response containing Definition of Complete role data
+ /// 41.4
+
+ public ApiResponse AddRolePermissions(PermissionsModel permissionsModel, string role)
+ {
+ if (permissionsModel == null)
+ {
+ throw new ArgumentException(BaseConstants.ValidationMessage, nameof(permissionsModel));
+ }
+ if (string.IsNullOrWhiteSpace(role))
+ {
+ throw new ArgumentException(BaseConstants.ValidationMessage, nameof(role));
+ }
+ var queryParameters = new QueryParameters
+ {
+ { "apiKey", ConfigDictionary[LRConfigConstants.LoginRadiusApiKey] },
+ { "apiSecret", ConfigDictionary[LRConfigConstants.LoginRadiusApiSecret] }
+ };
+
+ var resourcePath = $"identity/v2/manage/role/{role}/permission";
+
+ return ConfigureAndExecute(HttpMethod.PUT, resourcePath, queryParameters, ConvertToJson(permissionsModel));
+ }
+ ///
+ /// API is used to remove permissions from a role.
+ ///
+ /// Model Class containing Definition for PermissionsModel Property
+ /// Created RoleName
+ /// Response containing Definition of Complete role data
+ /// 41.5
+
+ public ApiResponse RemoveRolePermissions(PermissionsModel permissionsModel, string role)
+ {
+ if (permissionsModel == null)
+ {
+ throw new ArgumentException(BaseConstants.ValidationMessage, nameof(permissionsModel));
+ }
+ if (string.IsNullOrWhiteSpace(role))
+ {
+ throw new ArgumentException(BaseConstants.ValidationMessage, nameof(role));
+ }
+ var queryParameters = new QueryParameters
+ {
+ { "apiKey", ConfigDictionary[LRConfigConstants.LoginRadiusApiKey] },
+ { "apiSecret", ConfigDictionary[LRConfigConstants.LoginRadiusApiSecret] }
+ };
+
+ var resourcePath = $"identity/v2/manage/role/{role}/permission";
+
+ return ConfigureAndExecute(HttpMethod.DELETE, resourcePath, queryParameters, ConvertToJson(permissionsModel));
+ }
+ }
+}
\ No newline at end of file
diff --git a/Source/LoginRadiusSDK.V2/Api/Account/SottApi.cs b/Source/LoginRadiusSDK.V2/Api/Account/SottApi.cs
new file mode 100644
index 0000000..5a8f2d0
--- /dev/null
+++ b/Source/LoginRadiusSDK.V2/Api/Account/SottApi.cs
@@ -0,0 +1,40 @@
+//-----------------------------------------------------------------------
+//
+// Created by LoginRadius Development Team
+// Copyright 2019 LoginRadius Inc. All rights reserved.
+//
+//-----------------------------------------------------------------------
+
+using LoginRadiusSDK.V2.Common;
+using LoginRadiusSDK.V2.Util;
+using LoginRadiusSDK.V2.Models.ResponseModels;
+
+namespace LoginRadiusSDK.V2.Api.Account
+{
+ public class SottApi : LoginRadiusResource
+ {
+ ///
+ /// This API allows you to generate SOTT with a given expiration time.
+ ///
+ /// The time difference you would like to pass, If you not pass difference then the default value is 10 minutes
+ /// Sott data For Registration
+ /// 18.28
+
+ public ApiResponse GenerateSott(int? timeDifference = null)
+ {
+ var queryParameters = new QueryParameters
+ {
+ { "apiKey", ConfigDictionary[LRConfigConstants.LoginRadiusApiKey] },
+ { "apiSecret", ConfigDictionary[LRConfigConstants.LoginRadiusApiSecret] }
+ };
+ if (timeDifference != null)
+ {
+ queryParameters.Add("timeDifference", timeDifference.ToString());
+ }
+
+ var resourcePath = "identity/v2/manage/account/sott";
+
+ return ConfigureAndExecute(HttpMethod.GET, resourcePath, queryParameters, null);
+ }
+ }
+}
\ No newline at end of file
diff --git a/Source/LoginRadiusSDK.V2/Api/AccountApi.cs b/Source/LoginRadiusSDK.V2/Api/AccountApi.cs
deleted file mode 100644
index 53056bb..0000000
--- a/Source/LoginRadiusSDK.V2/Api/AccountApi.cs
+++ /dev/null
@@ -1,239 +0,0 @@
-using LoginRadiusSDK.V2.Entity;
-using LoginRadiusSDK.V2.Models;
-using LoginRadiusSDK.V2.Models.UserProfile;
-using LoginRadiusSDK.V2.Util;
-using System.Collections.Generic;
-using static LoginRadiusSDK.V2.Util.LoginRadiusArgumentValidator;
-using LoginRadiusSDK.V2.Models.Identity;
-using LoginRadiusSDK.V2.Models.CustomerAuthentication.Account;
-using LoginRadiusSDK.V2.Models.Object;
-
-namespace LoginRadiusSDK.V2.Api
-{
- public class AccountApi : LoginRadiusResource
- {
- ///
- /// This API is used to create an account in Cloud Storage. This API bypasses the normal email verification process and manually creates the user.
- ///
- /// UserIdentityCreateModel: An object holding the LoginRadius Profile on which the account is created.
- /// LoginRadiusUserIdentity: The account profile.
- public ApiResponse CreateAccount(UserIdentityCreateModel userIdentity)
- {
- Validate(new List