Add cidaas interceptor : ASP.Net (MVC and Core MVC)

Usage

Cidaas Interceptor works as custom ActionFilterAttribute,

Webconfig file

<appSettings>
   ....
    <add key="user_info_by_token_url" value="<your cidaas url>/token/userinfobytoken" />
    <add key="update_token_check_url" value="<your cidaas url>/token/updateusage"/>
  </appSettings>

Check Scope


[Interceptor(Scopes = new String[] { "yourbusiness:read","yourbusiness:manage" })]
public JsonResult GetAllUsers()
{
 return Json(new { data = repo.getAllUsers() }, JsonRequestBehavior.AllowGet);
}

Check Role


[Interceptor(Roles = new String[] { "ADMIN" })]
public JsonResult GetAdminUsers()
{
 return Json(new { data = repo.GetAdminUsers() }, JsonRequestBehavior.AllowGet);
}

Check Role and Scope


 [Interceptor(Roles = new String[] { "ADMIN" },Scopes = new String[] { "yourbusiness:read","yourbusiness:manage" })]
public JsonResult GetAdminUsers()
{
 return Json(new { data = repo.GetAdminUsers() }, JsonRequestBehavior.AllowGet);
}

DenyAll


[Interceptor(DenyAll = true)]
public JsonResult GetAdminUsers()
{
return Json(new { data = repo.GetAdminUsers() }, JsonRequestBehavior.AllowGet);
}

PermitAll


[Interceptor(PermitAll = true)]
public JsonResult GetAdminUsers()
{
return Json(new { data = repo.GetAdminUsers() }, JsonRequestBehavior.AllowGet);
}

OR just ignore the inceptor code

 public JsonResult GetAdminUsers()
{
return Json(new { data = repo.GetAdminUsers() }, JsonRequestBehavior.AllowGet);
}

Property Details

Field Default Value Required Max
user_info_by_token "" Yes
update_token_check_url "" Yes
tokenKey "access_token" No
updateIntervalInSec 5000 No 10000



Note
Don't have support for JWE


results matching ""

    No results matching ""