def payload(self, session, acr="", alg="RS256", code=None,
                access_token=None, user_info=None, auth_time=0,
                lifetime=300, extra_claims=None):
        """

        :param session: Session information
        :param acr: Default Assurance/Authentication context class reference
        :param alg: Which signing algorithm to use for the IdToken
        :param code: Access grant
        :param access_token: Access Token
        :param user_info: If user info are to be part of the IdToken
        :param auth_time:
        :param lifetime: Life time of the ID Token
        :param extra_claims: extra claims to be added to the ID Token
        :return: IDToken instance
        """

        _args = {'sub': session['sub']}

        if auth_time:
            _args["auth_time"] = auth_time
        if acr:
            _args["acr"] = acr

        if user_info:
            try:
                user_info = user_info.to_dict()
            except AttributeError:
                pass

            # Make sure that there are no name clashes
            for key in ["iss", "sub", "aud", "exp", "acr", "nonce",
                        "auth_time"]:
                try:
                    del user_info[key]
                except KeyError:
                    pass

            _args.update(user_info)

        if extra_claims is not None:
            _args.update(extra_claims)

        # Left hashes of code and/or access_token
        halg = "HS%s" % alg[-3:]
        if code:
            _args["c_hash"] = left_hash(code.encode("utf-8"), halg)
        if access_token:
            _args["at_hash"] = left_hash(access_token.encode("utf-8"),
                                         halg)

        authn_req = session['authn_req']
        if authn_req:
            try:
                _args["nonce"] = authn_req["nonce"]
            except KeyError:
                pass

        return {'payload': _args, 'lifetime': lifetime}
def payload ( self , session , acr = "" , alg = "RS256" , code = None , access_token = None , user_info = None , auth_time = 0 , lifetime = 300 , extra_claims = None ) : _args = { 'sub' : session [ 'sub' ] } if auth_time : _args [ "auth_time" ] = auth_time if acr : _args [ "acr" ] = acr if user_info : try : user_info = user_info . to_dict ( ) except AttributeError : pass for key in [ "iss" , "sub" , "aud" , "exp" , "acr" , "nonce" , "auth_time" ] : try : del user_info [ key ] except KeyError : pass _args . update ( user_info ) if extra_claims is not None : _args . update ( extra_claims ) halg = "HS%s" % alg [ - 3 : ] if code : _args [ "c_hash" ] = left_hash ( code . encode ( "utf-8" ) , halg ) if access_token : _args [ "at_hash" ] = left_hash ( access_token . encode ( "utf-8" ) , halg ) authn_req = session [ 'authn_req' ] if authn_req : try : _args [ "nonce" ] = authn_req [ "nonce" ] except KeyError : pass return { 'payload' : _args , 'lifetime' : lifetime }
:param session: Session information
        :param acr: Default Assurance/Authentication context class reference
        :param alg: Which signing algorithm to use for the IdToken
        :param code: Access grant
        :param access_token: Access Token
        :param user_info: If user info are to be part of the IdToken
        :param auth_time:
        :param lifetime: Life time of the ID Token
        :param extra_claims: extra claims to be added to the ID Token
        :return: IDToken instance