Class ZxingQRGenerator
java.lang.Object
se.swedenconnect.bankid.rpapi.service.impl.AbstractQRGenerator
se.swedenconnect.bankid.rpapi.service.impl.ZxingQRGenerator
- All Implemented Interfaces:
QRGenerator
A QR generator implementation based on the ZXing open source library.
Note: This implementation does not support the SVG image format.
- Author:
- Martin Lindström
-
Nested Class Summary
Nested classes/interfaces inherited from interface se.swedenconnect.bankid.rpapi.service.QRGenerator
QRGenerator.ImageFormat
-
Field Summary
Fields inherited from class se.swedenconnect.bankid.rpapi.service.impl.AbstractQRGenerator
DEFAULT_IMAGE_FORMAT, DEFAULT_SIZE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbyte[]
generateAnimatedQRCodeImage
(String qrStartToken, String qrStartSecret, Instant orderTime, int size, QRGenerator.ImageFormat format) Generates an "animated" QR code image.byte[]
generateQRCodeImage
(String autoStartToken, int size, QRGenerator.ImageFormat format) Generates a (static) QR code image.void
setDefaultImageFormat
(QRGenerator.ImageFormat defaultImageFormat) Assigns the configured default image format to use for generated QR images.Methods inherited from class se.swedenconnect.bankid.rpapi.service.impl.AbstractQRGenerator
buildAnimatedInput, buildInput, generateAnimatedQRCodeBase64Image, generateAnimatedQRCodeBase64Image, generateAnimatedQRCodeImage, generateQRCodeBase64Image, generateQRCodeBase64Image, generateQRCodeImage, setDefaultSize
-
Constructor Details
-
ZxingQRGenerator
public ZxingQRGenerator()
-
-
Method Details
-
generateQRCodeImage
public byte[] generateQRCodeImage(String autoStartToken, int size, QRGenerator.ImageFormat format) throws IOException Generates a (static) QR code image.The auto start token will be used to build an URI according to section 4.1 of the BankID Relying Party Guidelines.
- Parameters:
autoStartToken
- the BankID autostart tokensize
- the width and height of the generated QR code (in pixels)format
- the format for the generated QR code- Returns:
- an byte array representing the generated QR code
- Throws:
IOException
- for errors during generation- See Also:
-
generateAnimatedQRCodeImage
public byte[] generateAnimatedQRCodeImage(String qrStartToken, String qrStartSecret, Instant orderTime, int size, QRGenerator.ImageFormat format) throws IOException Generates an "animated" QR code image.The QR-code will be build according to section 4.2 of the BankID Relying Party Guidelines.
- Parameters:
qrStartToken
- the QR start token (seeOrderResponse.getQrStartToken()
)qrStartSecret
- the QR start secret (seeOrderResponse.getQrStartSecret()
)orderTime
- the instant when the result from anBankIDClient.authenticate(AuthenticateRequest)
orBankIDClient.sign(SignatureRequest)
call was receivedsize
- the width and height of the generated QR code (in pixels)format
- the format for the generated QR code- Returns:
- an byte array representing the generated QR code
- Throws:
IOException
- for errors during generation- See Also:
-
setDefaultImageFormat
Assigns the configured default image format to use for generated QR images.If not assigned,
AbstractQRGenerator.DEFAULT_IMAGE_FORMAT
will be used.- Overrides:
setDefaultImageFormat
in classAbstractQRGenerator
- Parameters:
defaultImageFormat
- the default format
-