Search in sources :

Example 1 with DummyXsuaaServiceConfiguration

use of com.sap.cloud.security.xsuaa.DummyXsuaaServiceConfiguration in project cloud-security-xsuaa-integration by SAP.

the class XsuaaAudienceValidatorTest method setup.

@Before
public void setup() throws IOException {
    serviceConfigurationSameClientId = new DummyXsuaaServiceConfiguration("sb-test1!t1", "test1!t1");
    serviceConfigurationOtherGrantedClientId = new DummyXsuaaServiceConfiguration("sb-test2!t1", "test2!t1");
    serviceConfigurationUnGrantedClientId = new DummyXsuaaServiceConfiguration("sb-test3!t1", "test3!t1");
    serviceConfigurationBrokerPlan = new DummyXsuaaServiceConfiguration("sb-test3!b1", "test3!b1");
    tokenWithAudience = new JwtGenerator().createFromTemplate("/audience_1.txt");
    tokenWithoutAudience = new JwtGenerator().createFromTemplate("/audience_2.txt");
    cloneTokenWithAudience = new JwtGenerator().createFromTemplate("/audience_3.txt");
    claimsBuilder = new JWTClaimsSet.Builder().issueTime(new Date()).expirationTime(JwtGenerator.NO_EXPIRE_DATE);
    claimsBuilder.claim(TokenClaims.CLAIM_CLIENT_ID, "sb-test1!t1");
}
Also used : JwtGenerator(com.sap.cloud.security.xsuaa.test.JwtGenerator) JWTClaimsSet(com.nimbusds.jwt.JWTClaimsSet) Date(java.util.Date) DummyXsuaaServiceConfiguration(com.sap.cloud.security.xsuaa.DummyXsuaaServiceConfiguration) Before(org.junit.Before)

Example 2 with DummyXsuaaServiceConfiguration

use of com.sap.cloud.security.xsuaa.DummyXsuaaServiceConfiguration in project cloud-security-xsuaa-integration by SAP.

the class XsuaaAudienceValidatorForCloneTokenTest method setup.

@Before
public void setup() {
    XsuaaServiceConfiguration serviceConfiguration = new DummyXsuaaServiceConfiguration("sb-test1!t1", "test1!t1");
    cut = new XsuaaAudienceValidator(serviceConfiguration);
    cut.configureAnotherXsuaaInstance(XSUAA_BROKER_XSAPPNAME, XSUAA_BROKER_CLIENT_ID);
    claimsBuilder = new JWTClaimsSet.Builder().issueTime(new Date()).expirationTime(JwtGenerator.NO_EXPIRE_DATE);
}
Also used : DummyXsuaaServiceConfiguration(com.sap.cloud.security.xsuaa.DummyXsuaaServiceConfiguration) XsuaaServiceConfiguration(com.sap.cloud.security.xsuaa.XsuaaServiceConfiguration) JWTClaimsSet(com.nimbusds.jwt.JWTClaimsSet) Date(java.util.Date) DummyXsuaaServiceConfiguration(com.sap.cloud.security.xsuaa.DummyXsuaaServiceConfiguration) Before(org.junit.Before)

Example 3 with DummyXsuaaServiceConfiguration

use of com.sap.cloud.security.xsuaa.DummyXsuaaServiceConfiguration in project cloud-security-xsuaa-integration by SAP.

the class XsuaaAudienceValidatorTest method testOtherGrantedClientIdWithoutAudienceAndDot.

@Test
public void testOtherGrantedClientIdWithoutAudienceAndDot() {
    OAuth2TokenValidatorResult result = new XsuaaAudienceValidator(new DummyXsuaaServiceConfiguration("sb-test4!t1", "test4!t1")).validate(tokenWithAudience);
    Assert.assertFalse(result.hasErrors());
}
Also used : OAuth2TokenValidatorResult(org.springframework.security.oauth2.core.OAuth2TokenValidatorResult) DummyXsuaaServiceConfiguration(com.sap.cloud.security.xsuaa.DummyXsuaaServiceConfiguration) Test(org.junit.Test)

Aggregations

DummyXsuaaServiceConfiguration (com.sap.cloud.security.xsuaa.DummyXsuaaServiceConfiguration)3 JWTClaimsSet (com.nimbusds.jwt.JWTClaimsSet)2 Date (java.util.Date)2 Before (org.junit.Before)2 XsuaaServiceConfiguration (com.sap.cloud.security.xsuaa.XsuaaServiceConfiguration)1 JwtGenerator (com.sap.cloud.security.xsuaa.test.JwtGenerator)1 Test (org.junit.Test)1 OAuth2TokenValidatorResult (org.springframework.security.oauth2.core.OAuth2TokenValidatorResult)1