liveBook · Manning

Custom authorization logic

As explained in Software Security for Developers

Custom authorization logic is application-defined code that verifies service requests and determines whether they should be accepted.

Custom authorization logic uses application-defined rules to verify a service request and decide whether to accept or reject it. It helps when OAuth2 or JWTs do not fit, or when API keys provide too little control. section 16.2 section 16.2.3

A signature-based implementation follows this pattern:

  • Give the calling service a private key and the receiving service the corresponding public key. section 16.2.3
  • Sign important request data, such as the path and timestamp, with the private key. section 16.2.3
  • Verify the signature with the public key; reject requests whose proof is invalid. section 16.2.3

Inventory service request

An inventory service signs an /adjust-stock request and its timestamp. The product service verifies that signature before processing the request, helping detect forgery or tampering. section 16.2.3

Figure 16.7 Key pairs and asymmetric cryptographic algorithms can be used to sign requests made by services to improve security. In this approach, the service signs the request with a private key. The service receiving the request can validate the signature using the public key and decide whether to approve or reject the request.
figure

Shows how a private key signs a service request and a public key supports the approval or rejection decision. section 16.2.3

How Software Security for Developers covers it

How deep it goes
Explains signing and verification with Java examples, but does not detail complete authorization-rule design.
Examples
Uses inventory and product services, signed stock-adjustment requests, timestamps, headers, and Java signer and verifier utilities.
What it assumes
Assumes basic service requests and introduces asymmetric keys through private-key signing and public-key verification.
What you can do after
Build it from scratch with Java signing and verification utilities for authenticated, integrity-protected service requests.
How it connects
Connects service identity with OAuth2, JWTs, API keys, asymmetric cryptography, digital signatures, and HTTP headers.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Software Security for Developers. The section links point to the parts of the book it draws on.