Example #1
0
 /// <summary>
 /// Authorizes calls to Hangfire dashboard
 /// </summary>
 /// <param name="owinEnvironment">Owin context data</param>
 /// <returns>flag indicating whether call is authorized or not</returns>
 public bool Authorize(DashboardContext context)
 {
     if (string.IsNullOrEmpty(context.Request.Path))
     {
         if (HttpContext.Current.Request.Form != null && HttpContext.Current.Request.Form.HasKeys())
         {
             string SAML = HttpContext.Current.Request.Form.GetValues(CommonConstants.SAMLHeaderKey).FirstOrDefault();
             if (!string.IsNullOrEmpty(SAML) && UserProfileInfo.IsAuthorised(SAML))
             {
                 return(true);
             }
             else
             {
                 return(false);
             }
         }
         else
         {
             return(false);
         }
     }
     return(true);
 }