use OpenCSV OpenCSV is able to serialize .csv files into preset and reusable schemas implemented as annotated Java pojo beans <!-- https://mvnrepository.com/artifact/com.opencsv/opencsv --> <dependency> <groupId>com.opencsv</groupId> <artifactId>opencsv</artifactId> <version>5.7.1</version> </dependency> Write CSV Read CSV opencsv –
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
show you the code: Base64 UrlEncoder for query parameter the key and iv are configured in properties in base64 format. So I use Base64 Decoder decode them before create SecretKeySpec and IvParameterSpec. new SecretKeySpec(Base64.getDecoder().decode(aliasKey), "AES"), new IvParameterSpec(Base64.getDecoder().decode(aliasIv))); Since I am using AES to encrypt query parameter which will be transport via internet. so I use Base64 UrlEncoder for encrption and UrlDecoder for decryption. return Ba
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Since I am using AES to encrypt query parameter which will be transport via internet. so I use Base64 UrlEncoder for encrption and UrlDecoder for decryption.
The answer is to use an embedded ldap server. spring-ldap-test bring an embedded ldap server based on ApacheDS or UnboundID. In this post, I will demo how I use UnboundID and spring-ldap-test to do testing against an embedded LDAP server. The UnboundID LDAP SDK for Java is a fast, powerful, user-friendly, and completely free Java library for communicating with LDAP directory servers. It offers better performance, better ease of use, and more features than other Java-based LDAP APIs. It is act
spring-ldap-test bring an embedded ldap server based on ApacheDS or UnboundID.
In this post, I will demo how I use UnboundID and spring-ldap-test to do testing against an embedded LDAP server.
The UnboundID LDAP SDK for Java is a fast, powerful, user-friendly, and completely free Java library for communicating with LDAP directory servers. It offers better performance, better ease of use, and more features than other Java-based LDAP APIs. It is actively being developed and enhanced by Ping Identity and is a critical component of their Directory Server and other identity management software.
Notes: please don't specify a port for the embedded LDAP server, it will find a free port for use. Otherwise your tests might failure due to port already been bind or used. Because each spring boot test will start an embedded LDAP server.
The LDAP Data Interchange Format (LDIF) is a standard plain text data interchange format for representing Lightweight Directory Access Protocol (LDAP) directory content and update requests. LDIF conveys directory content as a set of records, one record for each object (or entry). It also represents update requests, such as Add, Modify, Delete, and Rename, as a set of records, one record for each update request. LDIF was designed in the early 1990s by Tim Howes, Mark C. Smith, and Gordon Good while at the University of Michigan.
Below employee.ldif create a few entries to be pop to the LDAP server.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
That is all. Then in your spring boot tests, you should have an embedded LDAP server with the above employees entries. The LdapTemplate bean will be automatically configured for you too. I will write another post to guide you how to use LdapTemplate to do pagination search against your LDAP server.
Stay tuned!
Apache Directory Studio
I strong recommend this tool to explore your LDAP server directory while you build your spring boot java application with Spring LDAP framework.
Apache Directory Studio is a complete directory tooling platform intended to be used with any LDAP server however it is particularly designed for use with ApacheDS. It is an Eclipse RCP application, composed of several Eclipse (OSGi) plugins, that can be easily upgraded with additional ones. These plugins can even run within Eclipse itself.
In my previous post, I mentioned how to encrypt data with PGP public key. In this post, I will tell you how to decrypt the data with PGP private key. You need a PGP key pair to test the encryption and decryption and see it works. Check this post to generate the PGP key pair. Read|Load PGPPrivateKey from file don't forget the deps before you write your code. Check the encrypt post for it. Notes: The userId is the Real name + email address in format like: `Real <Email>` , you were asked to pro
In my previous post, I mentioned how to encrypt data with PGP public key. In this post, I will tell you how to decrypt the data with PGP private key. You need a PGP key pair to test the encryption and decryption and see it works. Check this post to generate the PGP key pair.
Read|Load PGPPrivateKey from file
don't forget the deps before you write your code. Check the encrypt post for it.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Notes: The userId is the Real name + email address in format like: `Real <Email>` , you were asked to provide these when you create the PGP key pair. Remember the password too.
Decrypt Data
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters