Create the claims set based on the userid of the claimed identity,
        the settings and the extra_claims dictionary.

        The userid will be stored in settings.jwtauth.userid_claim
        (default: "sub").
        If settings.jwtauth.expiration_delta is set it will be added
        to the current time and stored in the "exp" claim.
        If settings.jwtauth.issuer is set, it get stored in the "iss" claim.
        If settings.jwtauth.refresh_delta is set it will be added
        to the current time and stored in the "refresh_until" claim and
        the return value of settings.jwtauth.refresh_nonce_handler called with
        "user_id" as argument will be stored in the "nonce" claim.

        With the extra_claims dictionary you can provide additional claims.
        This can be registered claims like "nbf"
        (the time before which the token should not be processed) and/or
        claims containing extra info
        about the identity, which will be stored in the Identity object.

        :param request: current request object.
        :type request: :class:`morepath.Request`
        :param userid:  the userid of the claimed identity.
        :param extra_claims: dictionary, containing additional claims or None.

def create_claims_set(self, request, userid, extra_claims=None):
        """Create the claims set based on the userid of the claimed identity,
        the settings and the extra_claims dictionary.

        The userid will be stored in settings.jwtauth.userid_claim
        (default: "sub").
        If settings.jwtauth.expiration_delta is set it will be added
        to the current time and stored in the "exp" claim.
        If settings.jwtauth.issuer is set, it get stored in the "iss" claim.
        If settings.jwtauth.refresh_delta is set it will be added
        to the current time and stored in the "refresh_until" claim and
        the return value of settings.jwtauth.refresh_nonce_handler called with
        "user_id" as argument will be stored in the "nonce" claim.

        With the extra_claims dictionary you can provide additional claims.
        This can be registered claims like "nbf"
        (the time before which the token should not be processed) and/or
        claims containing extra info
        about the identity, which will be stored in the Identity object.

        :param request: current request object.
        :type request: :class:`morepath.Request`
        :param userid:  the userid of the claimed identity.
        :param extra_claims: dictionary, containing additional claims or None.
        """
        claims_set = {self.userid_claim: userid}
        now = timegm(datetime.utcnow().utctimetuple())
        if self.expiration_delta is not None:
            claims_set['exp'] = now + self.expiration_delta
        if self.issuer is not None:
            claims_set['iss'] = self.issuer
        if self.allow_refresh:
            if self.refresh_delta is not None:
                claims_set['refresh_until'] = now + self.refresh_delta
            if self.refresh_nonce_handler is not None:
                claims_set['nonce'] = self.refresh_nonce_handler(request,
                                                                 userid)
        if extra_claims is not None:
            claims_set.update(extra_claims)
        return claims_set