public override void OnActionExecuting(ActionExecutingContext context) { string token = context.HttpContext.Request.Headers.FirstOrDefault(x => x.Key == "access_token").Value; if (!TokenConfigurator.ValidToken(token)) { throw new NotAuthorizedException(); } base.OnActionExecuting(context); }
protected override void OnInit(EventArgs e) { base.OnInit(e); LocalResourceFile = ResXFile; //PortalId = foreach (var provider in TokenProvider.GetProviderList()) { if (!string.IsNullOrEmpty(provider.Configurator)) { var ctrl = this.LoadControl(provider.Configurator); TokenConfigurator conf = ctrl as TokenConfigurator; if (conf != null) { conf.PortalId = PortalId; conf.LocalResourceFile = LocalResourceFile; conf.ID = provider.FriendlyName; phConfigurator.Controls.Add(ctrl); } } } }
public IActionResult GetAccessToken() { return(Ok(TokenConfigurator.CreateToken())); }