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

uc-cdis / fence / 10119489915

27 Jul 2024 12:53AM UTC coverage: 75.109% (-0.03%) from 75.141%
10119489915

push

github

k-burt-uch
feat(PXP-11366): Remove passport from userinfo

7740 of 10305 relevant lines covered (75.11%)

0.75 hits per line

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

63.16
fence/jwt/utils.py
1
import flask
1✔
2

3
from cdislogging import get_logger
1✔
4

5
from fence.errors import Unauthorized
1✔
6

7

8
logger = get_logger(__name__)
1✔
9

10

11
def get_jwt_header():
1✔
12
    """
13
    Get the user's JWT from the Authorization header, or raise Unauthorized on failure.
14

15
    Return just the entire JWT as a string, without further validation or processing.
16
    """
17
    try:
1✔
18
        header = flask.request.headers["Authorization"]
1✔
19
    except KeyError:
×
20
        raise Unauthorized("missing authorization header")
×
21
    if not header.lower().startswith("bearer"):
1✔
22
        raise Unauthorized("unexpected Authorization header format (expected `Bearer`")
1✔
23
    try:
1✔
24
        jwt = header.split(" ")[1]
1✔
25
    except IndexError:
×
26
        msg = "authorization header missing token"
×
27
        logger.debug(f"{msg}. Received header: {header}")
×
28
        logger.error(f"{msg}.")
×
29
        raise Unauthorized(msg)
×
30
    return jwt
1✔
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