Complete the code to specify the component responsible for user authentication in a centralized auth system.
auth_service = [1]() # This service handles all user login requests centrally
The AuthServer is the centralized component that handles all authentication requests in a centralized authentication system.
Complete the code to represent a token verification step in a distributed auth system.
if service.verify_token([1]): grant_access()
In distributed authentication, services verify a JWT token locally to grant access without contacting a central server.
Fix the error in the code that incorrectly tries to validate tokens in a distributed system by calling a central auth service synchronously.
def authenticate(token): token = [1].validate_token(token) return token
In distributed auth, authentication should be done locally by verifying tokens, not by synchronous calls to a central service. LocalTokenVerifier handles this.
Fill both blanks to complete the code that shows how a distributed auth system validates a token and extracts user info.
if [1].validate([2]): user = [1].extract_user([2])
The TokenService validates the jwt_token locally and extracts user information in distributed authentication.
Fill all three blanks to complete the code that demonstrates centralized auth issuing a token after verifying credentials.
def login(user_input): if [1].verify([2]): return [3].issue_token([2]) else: return None
In centralized authentication, the CentralAuthService verifies the user_input credentials and the TokenIssuer issues a token upon success.