in integrations/shiro/shiro-authz/src/main/java/org/apache/aries/jax/rs/shiro/authz/impl/ShiroAuthorizationFeature.java [71:111]
public boolean configure(FeatureContext fc) {
Configuration configuration = fc.getConfiguration();
if(_LOG.isInfoEnabled()) {
@SuppressWarnings("unchecked")
Map<String, Object> applicationProps = (Map<String, Object>) configuration.getProperty(JAX_RS_APPLICATION_SERVICE_PROPERTIES);
_LOG.info("Registering the Shiro Authorization feature with application {}",
applicationProps.getOrDefault(JAX_RS_NAME, "<No Name found in application configuration>"));
}
Map<Class<?>, Integer> contracts = configuration.getContracts(ExceptionMapper.class);
if(contracts.isEmpty()) {
_LOG.debug("Registering the Shiro ExceptionMapper");
// Only register the ExceptionMapper if it isn't already registered
fc.register(ExceptionMapper.class, AUTHORIZATION);
} else if(AUTHORIZATION < contracts.getOrDefault(javax.ws.rs.ext.ExceptionMapper.class, USER)) {
_LOG.debug("Updating the priority of the Shiro ExceptionMapper from {} to {}",
contracts.getOrDefault(javax.ws.rs.ext.ExceptionMapper.class, USER),
AUTHORIZATION);
// Update the priority if it's registered too low
contracts.put(javax.ws.rs.ext.ExceptionMapper.class, AUTHORIZATION);
}
contracts = configuration.getContracts(SubjectPrincipalRequestFilter.class);
if(contracts.isEmpty()) {
_LOG.debug("Registering the Shiro SubjectPrincipalRequestFilter");
// Only register the SubjectPrincipalRequestFilter if it isn't already registered
fc.register(SubjectPrincipalRequestFilter.class, AUTHORIZATION);
} else if(AUTHORIZATION < contracts.getOrDefault(ContainerRequestFilter.class, USER)) {
_LOG.debug("Updating the priority of the Shiro SubjectPrincipalRequestFilter from {} to {}",
contracts.getOrDefault(ContainerRequestFilter.class, USER),
AUTHORIZATION);
// Update the priority if it's registered too low
contracts.put(ContainerRequestFilter.class, AUTHORIZATION);
}
_LOG.debug("Registering the Shiro ShiroAnnotationFilterFeature");
fc.register(ShiroAnnotationFilterFeature.class, Priorities.AUTHORIZATION);
return true;
}