Skip to content

Commit

Permalink
MID-9363: Generate token links with URL encoded special characters
Browse files Browse the repository at this point in the history
Signed-off-by: Tony Tkáčik <tonydamage@gmail.com>
  • Loading branch information
tonydamage committed Jan 18, 2024
1 parent 9a1ff21 commit a80747f
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.Serial;
import java.net.URLEncoder;
import java.nio.charset.CharacterCodingException;
import java.nio.charset.StandardCharsets;
import java.util.*;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -1784,7 +1786,12 @@ private String createBaseConfirmationLink(String prefix, String oid) {
}

private String createTokenConfirmationLink(String prefix, UserType userType) {
return createBaseConfirmationLink(prefix, userType) + "&" + SchemaConstants.TOKEN + "=" + getNonce(userType);
try {
var urlEncodedNonce = URLEncoder.encode(getNonce(userType), StandardCharsets.UTF_8);
return createBaseConfirmationLink(prefix, userType) + "&" + SchemaConstants.TOKEN + "=" + urlEncodedNonce;
} catch (Exception e) {
throw new SystemException(e);
}
}

private String createPrefixLinkByAuthSequence(String channel, String nameOfSequence,
Expand Down

0 comments on commit a80747f

Please sign in to comment.