REST Authentication
REST Authentication
REST API
Authentication
Methods
swipe
brijpandeyji
Diagram
Authentication
Who you are
Authorization
What you can do
swipe
brijpandeyji
Authentication
Authentication is the process of
proving that you are who you say
you are. It is the process of proving
your identity.
Example
An employee can enter the office if their
identity is verified using an ID card.
Authorization
Authorization is the process of
determining what actions you
are allowed to take based on
your identity and permissions.
Example
An employee may be allowed into the office
but may not be allowed into the server
room.
swipe
brijpandeyji
Authentication
Methods
API Key
OAuth (2.0
OpenID Connect
Basic Authentication
HTTP Basic Authentication is rarely
recommended due to its inherent
security vulnerabilities.
This method does not require cookies, session IDs, login pages, and
other such specialty solutions, and because it uses the HTTP header
itself, there’s no need to handshakes or other complex response
systems.
swipe
brijpandeyji
Bearer Authentication
Bearer authentication (also called
token authentication) is an HTTP
authentication scheme that involves
security tokens called bearer tokens.
swipe
brijpandeyji
API Keys
A unique value is created and
assigned to each first-time user in
this method as a way of identifying
them. This value serves as a marker
that indicates the user is known.
API keys are a common standard in the industry, but they should not be
considered a strong security measure. Despite their widespread use, it is
important to consider alternative measures to ensure the security of sensitive
information.
swipe
brijpandeyji
Application
swipe
brijpandeyji
API Keys
API keys are often included in the
query string of URLs, making it
easier for unauthorized
individuals to discover and access
them.
swipe
brijpandeyji
API Keys
API Keys are a useful tool because
they are easy to use. One identifier
is all that is needed, making them a
practical choice for certain
situations. Additionally, API Keys are
a valid option for a variety of
reasons.
swipe
brijpandeyji
OAuth (2.0)
OAuth 2.0 is an effective way to identify
individual user accounts and provide the
appropriate permissions. When using this
method, a user logs into a system, which
prompts the request for authentication.
This request is typically in the form of a
token, which the user then sends to an
authentication server. The server then
either denies or grants the authentication
request.
This is fundamentally a much more secure and powerful system than the other
approaches, mainly because it allows for the establishment of scopes which can
provide access to different parts of the API service and since the token is
revoked after a certain time - makes it much harder to re-use by attackers.
swipe
brijpandeyji
OAuth (2.0)
OAuth 2.0 is significantly simpler compared to
its predecessors, OAuth 1.0 and 1.0a. One of the
main improvements in OAuth 2.0 is the removal
of the requirement to sign every call with a
keyed hash. This simplifies the process
significantly compared to the previous
versions.
swipe
brijpandeyji
Authorization Cod
Implici
Resource Owner Passwor
Client Credentials
swipe
brijpandeyji
Authorization Code
The most common flow, mostly used
for server-side and mobile web
applications. This flow is similar to
how users sign up into a web
application using their Facebook or
Google account.
Implicit
The client must obtain an access
token on their own in this flow. It is
useful in situations where the user's
credentials cannot be stored in the
client code as they may be
accessible to external parties. This
prevents the risk of the user's
credentials being compromised.
swipe
brijpandeyji
Resource Owner
Password
To access this API, a user must
provide their login credentials
(username and password) as part of
the request. This method is only
suitable for trusted clients, such as
official applications released by the
API provider.
Client Credentials
This flow is designed for server-to-server
authentication and involves the client
application acting on its own behalf, rather
than representing an individual user. It is
used for authenticating communication
between servers.
swipe
brijpandeyji
OpenID Connect
OpenID Connect is a protocol that allows
clients to verify the identity of an end-
user by utilizing OAuth 2.0 as a base
and adding an additional identity layer.
This process is completed through the
use of an authorization server, which
performs the necessary authentication.
swipe
brijpandeyji
OpenID Connect
The specification suite is
extensible, supporting optional
features such as encryption of
identity data, the discovery of
OpenID Providers, and session
management.
swipe
brijpandeyji
JWT
JSON Web Tokens are an open,
industry-standard RFC 7519
method for representing claims
securely between two parties.
https://server.com/openid-configuration
swipe
brijpandeyji
JWT
This URL returns a JSON
listing of the OpenID/OAuth
endpoints, supported scopes
and claims, public keys used
to sign the tokens, and other
details.
swipe
brijpandeyji
Summary
OAuth 2.0 is the best choice for
most situations because it is easy
to use and provides strong
security. It also allows for
scalability, meaning it can be used
by many different providers at
once.
swipe
brijpandeyji
Follow Me On
LinkedIn
https://www.linkedin.com/in/brijpandeyji/