liveBook · Manning

Base64

As explained in Spring Security in Action, Second Edition

Base64 encoding represents arbitrary binary data as characters from a fixed 64-symbol alphabet and provides no confidentiality.

Base64 encodes arbitrary data using a fixed 64-symbol alphabet. It makes binary or credential strings convenient to transfer, but provides neither encryption nor confidentiality. section 2.1 section 2.2

Use Base64 with these practical constraints:

  • Encode the string username:password when constructing an HTTP Basic Authorization header. section 2.1
  • Prefix the encoded value with Basic in the Authorization header. section 2.2
  • Protect credentials with HTTPS because intercepted Base64 data remains readable. section 2.2
  • Recognize Base64-encoded JWT header and body data as readable content rather than encrypted secrets. section 13.2.2

Constructing an HTTP Basic header

Encode user:password with a Base64 tool, then send Authorization: Basic followed by the result. The resulting request authenticates like curl -u user:password, provided the credentials are valid. section 2.1

Figure 2.1 Our initial application employs HTTP Basic for user authentication and authorization when accessing an endpoint. It offers a REST endpoint at a specified route (/hello). Upon a successful request, it issues an HTTP 200 status message along with a response body. This instance illustrates the default authentication and authorization mechanisms set up by Spring Security.

Trace how a Spring endpoint receives HTTP Basic credentials and returns a successful response after authentication. section 2.1

How Spring Security in Action, Second Edition covers it

How deep it goes
Explains encoding, header placement, command-line construction, and confidentiality limits without detailing the encoding algorithm.
Examples
Demonstrates shell encoding, curl authentication, Authorization headers, and Base64-encoded JWT components.
What it assumes
Assumes familiarity with HTTP requests, Authorization headers, usernames, passwords, and basic Spring endpoint calls.
What you can do after
Apply Base64 with command-line tools to construct HTTP Basic headers and recognize readable token data.
How it connects
Connects Base64 with HTTP Basic authentication, HTTPS, JWT, encryption, hashing, and opaque tokens.

Also explained in

Compare how 7 books explain Base64 →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Spring Security in Action, Second Edition. The section links point to the parts of the book it draws on.