Skip to content

Commit

Permalink
improve docs of JwtIssuerValidator and SapIdJwtSignatureValidator (#1468
Browse files Browse the repository at this point in the history
)
  • Loading branch information
finkmanAtSap authored Feb 22, 2024
1 parent 72a3b80 commit 53e80d6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,11 @@ public ValidationResult validate(Token token) {
"Issuer validation can not be performed because token issuer is not a valid URL suitable for https.");
}

String issuerDomain = issuerUrl.substring(issuerUrl.indexOf("://") + 3); // issuerUrl was validated above to
// begin either with http:// or
// https://
// issuerUrl was validated above to begin either with http:// or https://
String issuerDomain = issuerUrl.substring(issuerUrl.indexOf("://") + 3);
for (String d : domains) {
// a string that ends with .<trustedDomain> and contains 1-63 letters, digits or
// '-' before that for the subdomain
// issuerDomain is valid if it is a string that ends with .<d> and contains 1-63 letters,
// digits or '-' before that for the subdomain
String validSubdomainPattern = String.format("^[a-zA-Z0-9-]{1,63}\\.%s$", Pattern.quote(d));
if (Objects.equals(d, issuerDomain) || issuerDomain.matches(validSubdomainPattern)) {
return createValid();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
import static com.sap.cloud.security.token.validation.validators.JsonWebKeyConstants.KID_PARAMETER_NAME;

/**
* Jwt Signature validator for OIDC tokens issued by Identity service
* Jwt Signature validator for OIDC tokens issued by Identity service. This validator MUST only be
* called after validating the token's issuer claim via {@link JwtIssuerValidator} first.
*/
class SapIdJwtSignatureValidator extends JwtSignatureValidator {
private boolean isTenantIdCheckEnabled = true;
Expand Down

0 comments on commit 53e80d6

Please sign in to comment.