• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

oauthlib / oauthlib / 15026256536

14 May 2025 04:38PM UTC coverage: 93.054% (+0.06%) from 92.992%
15026256536

Pull #898

github

web-flow
Merge 4f9ce52cb into dab6a5ae1
Pull Request #898: 3.3.0 release

1004 of 1110 branches covered (90.45%)

Branch coverage included in aggregate %.

25 of 26 new or added lines in 9 files covered. (96.15%)

10 existing lines in 1 file now uncovered.

3082 of 3281 relevant lines covered (93.93%)

5.61 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/oauthlib/openid/connect/core/exceptions.py
1
"""
2
oauthlib.oauth2.rfc6749.errors
3
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4

5
Error used both by OAuth 2 clients and providers to represent the spec
6
defined error responses for all four core grant types.
7
"""
NEW
8
from oauthlib.oauth2.rfc6749.errors import FatalClientError, OAuth2Error
×
9

10

11
class FatalOpenIDClientError(FatalClientError):
×
12
    pass
×
13

14

15
class OpenIDClientError(OAuth2Error):
×
16
    pass
×
17

18

19
class InteractionRequired(OpenIDClientError):
×
20
    """
21
    The Authorization Server requires End-User interaction to proceed.
22

23
    This error MAY be returned when the prompt parameter value in the
24
    Authentication Request is none, but the Authentication Request cannot be
25
    completed without displaying a user interface for End-User interaction.
26
    """
27
    error = 'interaction_required'
×
28
    status_code = 401
×
29

30

31
class LoginRequired(OpenIDClientError):
×
32
    """
33
    The Authorization Server requires End-User authentication.
34

35
    This error MAY be returned when the prompt parameter value in the
36
    Authentication Request is none, but the Authentication Request cannot be
37
    completed without displaying a user interface for End-User authentication.
38
    """
39
    error = 'login_required'
×
40
    status_code = 401
×
41

42

43
class AccountSelectionRequired(OpenIDClientError):
×
44
    """
45
    The End-User is REQUIRED to select a session at the Authorization Server.
46

47
    The End-User MAY be authenticated at the Authorization Server with
48
    different associated accounts, but the End-User did not select a session.
49
    This error MAY be returned when the prompt parameter value in the
50
    Authentication Request is none, but the Authentication Request cannot be
51
    completed without displaying a user interface to prompt for a session to
52
    use.
53
    """
54
    error = 'account_selection_required'
×
55

56

57
class ConsentRequired(OpenIDClientError):
×
58
    """
59
    The Authorization Server requires End-User consent.
60

61
    This error MAY be returned when the prompt parameter value in the
62
    Authentication Request is none, but the Authentication Request cannot be
63
    completed without displaying a user interface for End-User consent.
64
    """
65
    error = 'consent_required'
×
66
    status_code = 401
×
67

68

69
class InvalidRequestURI(OpenIDClientError):
×
70
    """
71
    The request_uri in the Authorization Request returns an error or
72
    contains invalid data.
73
    """
74
    error = 'invalid_request_uri'
×
75
    description = ('The request_uri in the Authorization Request returns an '
×
76
                  'error or contains invalid data.')
77

78

79
class InvalidRequestObject(OpenIDClientError):
×
80
    """
81
    The request parameter contains an invalid Request Object.
82
    """
83
    error = 'invalid_request_object'
×
84
    description = 'The request parameter contains an invalid Request Object.'
×
85

86

87
class RequestNotSupported(OpenIDClientError):
×
88
    """
89
    The OP does not support use of the request parameter.
90
    """
91
    error = 'request_not_supported'
×
92
    description = 'The request parameter is not supported.'
×
93

94

95
class RequestURINotSupported(OpenIDClientError):
×
96
    """
97
    The OP does not support use of the request_uri parameter.
98
    """
99
    error = 'request_uri_not_supported'
×
100
    description = 'The request_uri parameter is not supported.'
×
101

102

103
class RegistrationNotSupported(OpenIDClientError):
×
104
    """
105
    The OP does not support use of the registration parameter.
106
    """
107
    error = 'registration_not_supported'
×
108
    description = 'The registration parameter is not supported.'
×
109

110

111
class InvalidTokenError(OAuth2Error):
×
112
    """
113
    The access token provided is expired, revoked, malformed, or
114
    invalid for other reasons.  The resource SHOULD respond with
115
    the HTTP 401 (Unauthorized) status code.  The client MAY
116
    request a new access token and retry the protected resource
117
    request.
118
    """
119
    error = 'invalid_token'
×
120
    status_code = 401
×
121
    description = ("The access token provided is expired, revoked, malformed, "
×
122
                   "or invalid for other reasons.")
123

124

125
class InsufficientScopeError(OAuth2Error):
×
126
    """
127
    The request requires higher privileges than provided by the
128
    access token.  The resource server SHOULD respond with the HTTP
129
    403 (Forbidden) status code and MAY include the "scope"
130
    attribute with the scope necessary to access the protected
131
    resource.
132
    """
133
    error = 'insufficient_scope'
×
134
    status_code = 403
×
135
    description = ("The request requires higher privileges than provided by "
×
136
                   "the access token.")
137

138

139
def raise_from_error(error, params=None):
×
140
    import inspect
×
141
    import sys
×
142
    kwargs = {
×
143
        'description': params.get('error_description'),
144
        'uri': params.get('error_uri'),
145
        'state': params.get('state')
146
    }
147
    for _, cls in inspect.getmembers(sys.modules[__name__], inspect.isclass):
×
148
        if cls.error == error:
×
149
            raise cls(**kwargs)
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc