use of org.apereo.cas.services.RegisteredServiceAccessStrategyAuditableEnforcer in project cas by apereo.
the class RegisteredServiceAccessStrategyAuditableEnforcerTests method verifyTgtAndServiceAndRegisteredServicePresentButDisabled.
@Test
public void verifyTgtAndServiceAndRegisteredServicePresentButDisabled() {
val service = createRegisteredService(false);
val context = AuditableContext.builder().registeredService(service).service(createService()).ticketGrantingTicket(createTicketGrantingTicket()).build();
val result = new RegisteredServiceAccessStrategyAuditableEnforcer(new CasConfigurationProperties()).execute(context);
assertTrue(result.isExecutionFailure());
assertTrue(result.getException().isPresent());
}
use of org.apereo.cas.services.RegisteredServiceAccessStrategyAuditableEnforcer in project cas by apereo.
the class RegisteredServiceAccessStrategyAuditableEnforcerTests method verifyTgtRejectedPrincipalAttributes.
@Test
public void verifyTgtRejectedPrincipalAttributes() {
val service = createRegisteredService(true);
((DefaultRegisteredServiceAccessStrategy) service.getAccessStrategy()).setRejectedAttributes(reject(false));
val context = AuditableContext.builder().registeredService(service).service(createService()).ticketGrantingTicket(createTicketGrantingTicket()).build();
val result = new RegisteredServiceAccessStrategyAuditableEnforcer(new CasConfigurationProperties()).execute(context);
assertTrue(result.isExecutionFailure());
assertTrue(result.getException().isPresent());
}
use of org.apereo.cas.services.RegisteredServiceAccessStrategyAuditableEnforcer in project cas by apereo.
the class RegisteredServiceAccessStrategyAuditableEnforcerTests method verifyRegisteredServicePresentButDisabled.
@Test
public void verifyRegisteredServicePresentButDisabled() {
val service = createRegisteredService(false);
val context = AuditableContext.builder().registeredService(service).build();
val result = new RegisteredServiceAccessStrategyAuditableEnforcer(new CasConfigurationProperties()).execute(context);
assertTrue(result.isExecutionFailure());
assertTrue(result.getException().isPresent());
}
use of org.apereo.cas.services.RegisteredServiceAccessStrategyAuditableEnforcer in project cas by apereo.
the class RegisteredServiceAccessStrategyAuditableEnforcerTests method verifyExceptionNotThrown.
@Test
public void verifyExceptionNotThrown() {
val context = AuditableContext.builder().build();
val result = new RegisteredServiceAccessStrategyAuditableEnforcer(new CasConfigurationProperties()).execute(context);
assertTrue(result.isExecutionFailure());
assertTrue(result.getException().isPresent());
}
use of org.apereo.cas.services.RegisteredServiceAccessStrategyAuditableEnforcer in project cas by apereo.
the class RegisteredServiceAccessStrategyAuditableEnforcerTests method verifyAuthAndServiceAndRegisteredServicePresentAndEnabled.
@Test
public void verifyAuthAndServiceAndRegisteredServicePresentAndEnabled() {
val service = createRegisteredService(true);
val context = AuditableContext.builder().registeredService(service).service(createService()).authentication(createAuthentication()).build();
val result = new RegisteredServiceAccessStrategyAuditableEnforcer(new CasConfigurationProperties()).execute(context);
assertFalse(result.isExecutionFailure());
assertFalse(result.getException().isPresent());
}
Aggregations