Test your knowledge of the differences between authentication and authorization in APIs, including sessions, tokens, OAuth2 basics, and common testing scenarios.
Distinguishing AuthN from AuthZ
In the context of an API that checks a user's password before granting access, what type of mechanism is this?
- Access Granting
- Audit Control
- Authentization
- Authentication
- Authorization
Purpose of Authorization
When an API restricts a user to only view, but not edit, specific data, what security principle is being enforced?
- Authentication
- Auditing
- Authorization
- Allowance
- Authentification
Sessions in APIs
Which of the following best describes a session in API authentication processes?
- A user’s access control list
- A method of authorizing user roles
- A type of password reset mechanism
- A permanent storage of user credentials
- A temporary state maintained to identify a user after login
Token Usage
What is the main purpose of using tokens in API security?
- To validate email addresses
- To initiate session timeouts
- To encrypt API endpoints
- To permanently store passwords in transit
- To identify a user and confirm their identity across requests
OAuth2: Roles Explained
In OAuth2 flows, what does the term 'resource owner' typically refer to?
- The user who grants access to their data
- An encryption algorithm
- An application’s administrator
- The API gateway
- The server hosting a website
Testing Authentication Failures
When testing API authentication, what is a common case to check?
- Submitting incorrect credentials to verify access is denied
- Sending repeated POST requests to the same URL
- Requesting non-existent endpoints
- Checking server's IP address
- Measuring response time after authentication
Authorization Test Case Example
If an unauthorized user attempts to access another user's private data, which outcome demonstrates proper authorization control?
- The response contains a list of all users
- The application forcefully logs out all users
- The API redirects the user to a homepage
- The API generates a random error message
- The API returns a forbidden or unauthorized response
Session Expiry Scenario
What is the intended behavior when an API session token expires?
- The user must re-authenticate to continue
- The API automatically upgrades user privileges
- The session remains valid indefinitely
- The password is updated in the background
- The system deletes user data irreversibly
OAuth2 Grant Types
Which grant type in OAuth2 is commonly used by applications to directly obtain an access token using a user's credentials?
- Implicit
- Resource Owner Password Credentials
- Authorization Code
- Refresh
- Client Credentials
Mixing Up Terms
Which of the following describes the difference between authentication (AuthN) and authorization (AuthZ) in APIs?
- Authorization checks user passwords, while authentication assigns roles
- Authorization requires passwords, while authentication does not
- Authentication encrypts data, while authorization decrypts it
- Authentication is only for administrators, while authorization is for users
- Authentication verifies identity, while authorization determines access levels