Skip to content
This repository has been archived by the owner on Jan 31, 2020. It is now read-only.

Flesh out protected_endpoint decorator #2

Merged
merged 12 commits into from
Sep 11, 2014
Merged

Flesh out protected_endpoint decorator #2

merged 12 commits into from
Sep 11, 2014

Conversation

davidlmorton
Copy link
Contributor

I'll continue to add to this pull-request.

@coveralls
Copy link

Coverage Status

Coverage remained the same when pulling a2b5d34 on davidlmorton:master into 7d80778 on mark-burnett:master.

@mark-burnett
Copy link
Contributor

Here is a sketch of a slightly different approach to _parse_request that avoids having multiple return values.

@mark-burnett
Copy link
Contributor

Here is an example of building a signed/encrypted JWT programatically.

@coveralls
Copy link

Coverage Status

Coverage decreased (-1.96%) when pulling 78d4c16 on davidlmorton:master into 7d80778 on mark-burnett:master.

def _execute_target(self, *args, **kwargs):
try:
id_token = self._extract_id_token()
except Exception as e:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're probably still working on this, but you can define a tuple of exception classes that you want to catch, then use it here:

_INVALID_AUTH_EXCEPTIONS = (MissingAutheHeadersError, MalformedAccessTokenError, InvalidSerialization)

<snip>

        try:
            id_token = self._extract_id_token()
        except _INVALID_AUTH_EXCEPTIONS as e:
            return self.exception_map[e.__class__]
        except:
            LOG.exception('Bad things happened')
<snip>

@coveralls
Copy link

Coverage Status

Coverage remained the same when pulling 4a02b52 on davidlmorton:master into 7d80778 on mark-burnett:master.

davidlmorton added a commit that referenced this pull request Sep 11, 2014
Flesh out protected_endpoint decorator
@davidlmorton davidlmorton merged commit 70c6d28 into genome:master Sep 11, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants