Class QrCodeRenderer
java.lang.Object
com.irurueta.authserver.authorization.api.web.totp.QrCodeRenderer
Renders a text as a QR code, as a PNG image in a
data: URI an authenticator app enrolment page can show
without another request. The image is built in memory and never stored or logged, since it carries a secret.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
DATA_URI_PREFIX
Prefix of thedata:URI of a PNG image.- See Also:
-
SIZE
static final int SIZEWidth and height of the image, in pixels.- See Also:
-
PNG
Name of the image format.- See Also:
-
MARGIN
private static final int MARGINQuiet zone around the code, in modules.- See Also:
-
-
Constructor Details
-
QrCodeRenderer
public QrCodeRenderer()
-
-
Method Details
-
render
Renders a text.- Parameters:
content- the text to encode.- Returns:
- a
data:image/png;base64,...URI of the QR code. - Throws:
IllegalStateException- if the text cannot be encoded.
-