-
Notifications
You must be signed in to change notification settings - Fork 28
TokenAuthConfiguration
Aviran edited this page Oct 6, 2013
·
3 revisions
The WebAPI Token Auth Bootstrap allow you to configure it to your own needs, using the static TokenAuthConfiguration class at your Application_Start() at Global.asax file.
`TokenAuthConfiguration` Class Properties:
public static List<ITokenFetcher> TokenFetchers { get; set; }
public static ITokenProvider TokenProvider { get; set; }
public static IDataFetcher UserFetcher { get; set; }
public static ITokenStorage TokenStorage { get; set; }
public static Dictionary<string, string> UnauthorizedMessageResponse { get; set; }
public static string TokenName { get; set; }
public static string UserCookieName { get; set; }
public static object RolePropertyName { get; set; }
Here is the default configuration:
TokenStorage = new InMemoryTokenStorage();
UserFetcher = new CookieDataFetcher(new Lazy<string>(() => UserCookieName));
RolePropertyName = DefaultRolePropertyName;
TokenName = DefaultTokenName;
UserCookieName = DefaultUserCookieName;
TokenFetchers = new List<ITokenFetcher> { new CookieTokenFetcher() };
TokenProvider = new CacheableTokenProvider(new InMemoryTokenStorage(), new Base64TokenGenerator());
UnauthorizedMessageResponse = new Dictionary<string, string>
{
{DefaultUnauthorizedMessageName, DefaultUnauthorizedMessage}
};
with the following default values:
DefaultRolePropertyName = "role";
DefaultUnauthorizedMessageName = "You are no authorized to access this resource.";
DefaultUnauthorizedMessage = "You are no authorized to access this resource.";
DefaultTokenName = "token";
DefaultUserCookieName = "user";