getUserClaim

Brixxapi allows user to set a claim value. This claim Value gets added when user gets logged in. It is used to identify users claim. For example, to check whether a user is someone who he claims to be or not. By using this function, we can get userClaim and make useful comparisons in our apps.

Parameters

  1. claimName - This is the only paramter this function takes. It is the claiName which should be in the form of string.. Brixxapi allows user to add claim name with or with out "claim_" prefix.

Example

Let suppose we have a claimName parameter "EFitDealer" then Brixxapi will consider both "EFitDealer" and "claim_EFitDealer" as same.

Example Usages

We can use "getUserClaim" function to get user's claim, a way to check user identity. As a parameter, we need to provide the claimName to this function. We can provide only the claimName or the claimName plus "claim_" as prefix. Lets see both of them in action. We have a claimName "EfitDealerNumber", now we want to get userClaim:

Lets first do it without prefix "claim_".

   let dealerNumber = brixxApi.getUserClaim("EfitDealerNumber");
   console.log("The dealer Number is: " + dealerNumber);

It is ame as the previous example but now we use prefix.

   let dealerNumber = brixxApi.getUserClaim("claim_EfitDealerNumber");
   console.log("The dealer Number is: " + dealerNumber);

An important thing to notice here is that it is required by Brixxbox that for using SQL Parameters for claims must have to start with the "claim_" prefix.

For example, Userclaims can also be used as SQL parameters:

   select @claim_EfitDealerNumber

Last updated