use of com.microsoft.azure.oidc.token.signature.Signature in project azure-tools-for-java by Microsoft.
the class SimpeTokenParser method getToken.
@Override
public Token getToken(String value) {
final String[] parts = value.split("\\.");
if (parts.length != 3) {
throw new IllegalStateException(String.format("Incorrect number of parts: Expected 3 got %s", parts.length));
}
final JsonNode header = parsePart(decodePart(parts[0]));
final JsonNode body = parsePart(decodePart(parts[1]));
final Name keyName = getKeyName(header);
final Algorithm algorithm = getAlgorithm(header);
final TimeStamp issuedAt = getIssuedAt(body);
final TimeStamp notBefore = getNotBefore(body);
final TimeStamp expiration = getExpiration(body);
final Issuer issuer = getIssuer(body);
final ID audience = getAudience(body);
final ID userID = getUserID(body);
final List<Email> userEmails = getEmails(body);
final Payload payload = getPayload(parts[0], parts[1]);
final Signature signature = getSignature(parts[2]);
return tokenFactory.createToken(keyName, algorithm, issuedAt, notBefore, expiration, userID, userEmails, issuer, audience, payload, signature);
}
Aggregations