public static TResult GetClaimsFromJwtToken <TResult>(this string jwtString, Func <IEnumerable <Claim>, TResult> success, Func <TResult> authorizationNotSet, Func <string, TResult> failure, string issuerConfigSetting = EastFive.Security.AppSettings.TokenIssuer, string validationKeyConfigSetting = EastFive.Security.AppSettings.TokenKey) { if (String.IsNullOrWhiteSpace(jwtString)) { return(authorizationNotSet()); } return(jwtString.GetClaimsJwtString( success, (why) => { //var siteAdminAuthorization = CloudConfigurationManager.GetSetting( // EastFive.Api.AppSettings.SiteAdminAuthorization); return EastFive.Api.AppSettings.SiteAdminAuthorization.ConfigurationString( siteAdminAuthorization => { if (string.IsNullOrEmpty(siteAdminAuthorization)) { return failure(why); //TODO - log if this is not set? } if (String.Compare(siteAdminAuthorization, jwtString, false) != 0) { return failure(why); } return EastFive.Web.Configuration.Settings.GetString( EastFive.Api.AppSettings.ActorIdClaimType, (actorIdClaimType) => { return EastFive.Web.Configuration.Settings.GetString( EastFive.Api.AppSettings.ActorIdSuperAdmin, (actorIdSuperAdmin) => { var claim = new Claim(actorIdClaimType, actorIdSuperAdmin); return success(claim.AsArray()); }, failure); }, failure); }); }, issuerConfigSetting, validationKeyConfigSetting)); }