Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        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);
        }