@ -5,6 +5,8 @@ import static org.gcube.smartgears.handlers.application.request.RequestError.app
import static org.gcube.smartgears.handlers.application.request.RequestError.application_unavailable_error ;
import static org.gcube.smartgears.handlers.application.request.RequestError.invalid_request_error ;
import java.util.Set ;
import javax.xml.bind.annotation.XmlRootElement ;
import org.gcube.common.security.ContextBean ;
@ -92,10 +94,11 @@ public class RequestValidator extends RequestHandler {
ContextBean bean = new ContextBean ( context ) ;
ContainerConfiguration conf = appContext . container ( ) . configuration ( ) ;
if ( ! conf . allowedContexts ( ) . contains ( context ) & &
Set < String > allowedContexts = conf . authorizationProvider ( ) . getContexts ( ) ;
if ( ! allowedContexts . contains ( context ) & &
! ( conf . authorizeChildrenContext ( ) & & bean . is ( Type . VRE )
& & conf. allowedContexts( ) . contains ( bean . enclosingScope ( ) . toString ( ) ) ) ) {
log . warn ( "rejecting call to {} in invalid context {}, allowed context are {}" , appContext . name ( ) , context , a ppContext. container ( ) . configuration ( ) . a llowedContexts( ) ) ;
& & allowedContexts. contains ( bean . enclosingScope ( ) . toString ( ) ) ) ) {
log . warn ( "rejecting call to {} in invalid context {}, allowed context are {}" , appContext . name ( ) , context , a llowedContexts) ;
invalid_request_error . fire ( appContext . name ( ) + " cannot be called in scope " + context ) ;
}
}