001package com.nimbusds.openid.connect.provider.spi; 002 003 004import jakarta.servlet.ServletContext; 005import org.checkerframework.checker.nullness.qual.Nullable; 006import org.infinispan.manager.EmbeddedCacheManager; 007 008import java.io.InputStream; 009 010 011/** 012 * Context for the initialisation of SPI implementations. 013 * 014 * <p>Provides: 015 * 016 * <ul> 017 * <li>Access to the web application context. 018 * <li>A method to retrieve a configuration or another file in the web 019 * application package. 020 * <li>Access to the Infinispan cache manager. 021 * </ul> 022 */ 023public interface InitContext { 024 025 026 /** 027 * Returns the servlet context. 028 * 029 * @return The servlet context. 030 */ 031 ServletContext getServletContext(); 032 033 034 /** 035 * Returns the resource located at the named path as an input stream. 036 * Has the same behaviour as 037 * {@link jakarta.servlet.ServletContext#getResourceAsStream}. 038 * 039 * @param path The path to the resource, must begin with a '/' and is 040 * interpreted as relative to the web application root. 041 * Must not be {@code null}. 042 * 043 * @return The resource as an input stream, or {@code null} if no 044 * resource exists at the specified path. 045 */ 046 @Nullable InputStream getResourceAsStream(final String path); 047 048 049 /** 050 * Returns the Infinispan cache manager. 051 * 052 * @return The Infinispan cache manager. 053 */ 054 EmbeddedCacheManager getInfinispanCacheManager(); 055}