public Task <ThrottleStatus> EvaluatePreAuthentication(ThreatDetectionLogger logger, RequestContext requestContext, SecurityContext securityContext, ProtocolContext protocolContext, IList <Claim> additionalClams) { try { RiskScore isRisky = RiskyUserHelper.GetRiskScore(securityContext.UserIdentifier); if (isRisky == RiskScore.High) { logger?.WriteAdminLogErrorMessage($"EvaluatePreAuthentication: Blocked request for user {securityContext.UserIdentifier}"); return(Task.FromResult <ThrottleStatus>(ThrottleStatus.Block)); } logger?.WriteDebugMessage($"EvaluatePreAuthentication: Allowed request for user {securityContext.UserIdentifier}"); return(Task.FromResult <ThrottleStatus>(ThrottleStatus.Allow)); } catch (Exception ex) { logger.WriteAdminLogErrorMessage(ex.ToString()); throw; } throw new NotImplementedException(); }
Task <RiskScore> IPostAuthenticationThreatDetectionModule.EvaluatePostAuthentication(ThreatDetectionLogger logger, RequestContext requestContext, SecurityContext securityContext, ProtocolContext protocolContext, AuthenticationResult authenticationResult, IList <Claim> additionalClams) { try { RiskScore isRisky = RiskyUserHelper.GetRiskScore(securityContext.UserIdentifier); if (isRisky == RiskScore.High || isRisky == RiskScore.Medium) { logger?.WriteAdminLogErrorMessage($"EvaluatePostAuthentication: Risk Score {isRisky} returned for user {securityContext.UserIdentifier}"); } else { logger?.WriteDebugMessage($"EvaluatePostAuthentication: Risk Score {isRisky} returned for user {securityContext.UserIdentifier}"); } return(Task.FromResult <RiskScore>(isRisky)); } catch (Exception ex) { logger.WriteAdminLogErrorMessage(ex.ToString()); throw; } throw new NotImplementedException(); }