@Test public void isValid_NoSubClaimGiven_ShouldNotBeValid() { GatewayRequest request = createRequestMock(null, null); assertFalse(createSecurityContextFactory(request).isValid()); }
@Override protected boolean isValid() { Object rawClaims = getRawClaimsSafe(); if (!(rawClaims instanceof Map)) { LOG.debug("claims must be a map"); return false; } @SuppressWarnings("unchecked") Map<String, Object> claims = (Map<String, Object>) rawClaims; if (!(claims.get(OpenIdClaimFieldNames.STANDARD_CLAIM_SUB) instanceof String)) { LOG.debug("sub claim must be present and of type string"); return false; } Object rawAddressClaim = claims.get(OpenIdClaimFieldNames.STANDARD_CLAIM_ADDRESS); if (rawAddressClaim != null && !(rawAddressClaim instanceof Map)) { LOG.debug("address claim must be a map if present"); return false; } return true; }
CognitoUserPoolSecurityContextFactory extends AbstractSecurityContextFactory { @Override protected boolean isValid() { Object rawClaims = getRawClaimsSafe(); if (!(rawClaims instanceof Map)) { LOG.debug("claims must be a map"); return false; } @SuppressWarnings("unchecked") Map<String, Object> claims = (Map<String, Object>) rawClaims; if (!(claims.get(OpenIdClaimFieldNames.STANDARD_CLAIM_SUB) instanceof String)) { LOG.debug("sub claim must be present and of type string"); return false; } Object rawAddressClaim = claims.get(OpenIdClaimFieldNames.STANDARD_CLAIM_ADDRESS); if (rawAddressClaim != null && !(rawAddressClaim instanceof Map)) { LOG.debug("address claim must be a map if present"); return false; } return true; } }
CognitoUserPoolSecurityContextFactory extends AbstractSecurityContextFactory { @Override protected boolean isValid() { Object rawClaims = getRawClaimsSafe(); if (!(rawClaims instanceof Map)) { LOG.debug("claims must be a map"); return false; } @SuppressWarnings("unchecked") Map<String, Object> claims = (Map<String, Object>) rawClaims; if (!(claims.get(OpenIdClaimFieldNames.STANDARD_CLAIM_SUB) instanceof String)) { LOG.debug("sub claim must be present and of type string"); return false; } Object rawAddressClaim = claims.get(OpenIdClaimFieldNames.STANDARD_CLAIM_ADDRESS); if (rawAddressClaim != null && !(rawAddressClaim instanceof Map)) { LOG.debug("address claim must be a map if present"); return false; } return true; } protected  CognitoUserPoolSecurityContextFactory(@Nonnull GatewayRequest request); }
CognitoUserPoolSecurityContextFactory extends AbstractSecurityContextFactory { @Override protected boolean isValid() { Object rawClaims = getRawClaimsSafe(); if (!(rawClaims instanceof Map)) { LOG.debug("claims must be a map"); return false; } @SuppressWarnings("unchecked") Map<String, Object> claims = (Map<String, Object>) rawClaims; if (!(claims.get(OpenIdClaimFieldNames.STANDARD_CLAIM_SUB) instanceof String)) { LOG.debug("sub claim must be present and of type string"); return false; } Object rawAddressClaim = claims.get(OpenIdClaimFieldNames.STANDARD_CLAIM_ADDRESS); if (rawAddressClaim != null && !(rawAddressClaim instanceof Map)) { LOG.debug("address claim must be a map if present"); return false; } return true; } protected  CognitoUserPoolSecurityContextFactory(@Nonnull GatewayRequest request);  }
CognitoUserPoolSecurityContextFactory extends AbstractSecurityContextFactory { @Override protected boolean isValid() { Object rawClaims = getRawClaimsSafe(); if (!(rawClaims instanceof Map)) { LOG.debug("claims must be a map"); return false; } @SuppressWarnings("unchecked") Map<String, Object> claims = (Map<String, Object>) rawClaims; if (!(claims.get(OpenIdClaimFieldNames.STANDARD_CLAIM_SUB) instanceof String)) { LOG.debug("sub claim must be present and of type string"); return false; } Object rawAddressClaim = claims.get(OpenIdClaimFieldNames.STANDARD_CLAIM_ADDRESS); if (rawAddressClaim != null && !(rawAddressClaim instanceof Map)) { LOG.debug("address claim must be a map if present"); return false; } return true; } protected  CognitoUserPoolSecurityContextFactory(@Nonnull GatewayRequest request);   }