def create_token(user_id: str, name: str, login: str, provider: str, customers: List[str], scopes: List[str], email: str = None, email_verified: bool = None, picture: str = None, **kwargs) -> 'Jwt': now = datetime.utcnow() return Jwt(iss=request.url_root, typ='Bearer', sub=user_id, aud=current_app.config.get('OAUTH2_CLIENT_ID') or current_app.config.get('SAML2_ENTITY_ID') or absolute_url(), exp=(now + timedelta(days=current_app.config['TOKEN_EXPIRE_DAYS'])), nbf=now, iat=now, jti=str(uuid4()), name=name, preferred_username=login, email=email, email_verified=email_verified, provider=provider, scopes=scopes, customers=customers, picture=picture, **kwargs)
def create_token(user_id: str, name: str, login: str, provider: str, customers: List[str], orgs: List[str] = None, groups: List[str] = None, roles: List[str] = None, email: str = None, email_verified: bool = None) -> 'Jwt': now = datetime.utcnow() scopes = Permission.lookup(login, groups=(roles or []) + (groups or []) + (orgs or [])) return Jwt(iss=request.url_root, typ='Bearer', sub=user_id, aud=current_app.config.get('OAUTH2_CLIENT_ID', None) or request.url_root, exp=(now + timedelta(days=current_app.config['TOKEN_EXPIRE_DAYS'])), nbf=now, iat=now, jti=str(uuid4()), name=name, preferred_username=login, orgs=orgs, roles=roles, groups=groups, provider=provider, scopes=scopes, email=email, email_verified=email_verified, customers=customers)