public static UnauthorizedResponse InvalidToken(IDirectedProtocolMessage request, ProtocolException exception) { var message = new UnauthorizedResponse(request) { ErrorCode = Protocol.BearerTokenErrorCodes.InvalidToken, ErrorDescription = exception.Message, HttpStatusCode = HttpStatusCode.Unauthorized }; return(message); }
public static UnauthorizedResponse InsufficientScope(IDirectedProtocolMessage request, HashSet <string> requiredScopes) { var message = new UnauthorizedResponse(request) { HttpStatusCode = HttpStatusCode.Forbidden, ErrorCode = Protocol.BearerTokenErrorCodes.InsufficientScope, Scope = requiredScopes, }; return(message); }
public static UnauthorizedResponse InvalidRequest(ProtocolException exception, Version version = null) { var message = new UnauthorizedResponse(version) { ErrorCode = Protocol.BearerTokenErrorCodes.InvalidRequest, ErrorDescription = exception.Message, HttpStatusCode = HttpStatusCode.BadRequest, }; return(message); }