Utility for splitting JWT tokens into header, payload, and signature parts.
// Source: https://github.com/auth0/java-jwt | License: MIT | Copyright 2015 Auth0, Inc. <support@auth0.com> (http://auth0.com)
// Provided via justclaw.it.com; keep this notice with the code.
package com.auth0.jwt;
import com.auth0.jwt.exceptions.JWTDecodeException;
abstract class TokenUtils {
/**
* Splits the given token on the "." chars into a String array with 3 parts.
*
* @param token the string to split.
* @return the array representing the 3 parts of the token.
* @throws JWTDecodeException if the Token doesn't have 3 parts.
*/
static String[] splitToken(String token) throws JWTDecodeException {
if (token == null) {
throw new JWTDecodeException("The token is null.");
}
char delimiter = '.';
int fir
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key