001package com.nimbusds.openid.connect.provider.spi; 002 003 004import java.io.InputStream; 005import java.net.URI; 006import javax.servlet.ServletContext; 007 008import com.nimbusds.oauth2.sdk.id.Issuer; 009import org.infinispan.manager.EmbeddedCacheManager; 010 011 012/** 013 * Context for the initialisation of SPI implementations. 014 * 015 * <p>Provides: 016 * 017 * <ul> 018 * <li>Access to the web application context. 019 * <li>A method to retrieve a configuration or another file in the web 020 * application package. 021 * <li>Access to the Infinispan cache manager. 022 * </ul> 023 */ 024public interface InitContext { 025 026 027 /** 028 * Returns the servlet context. 029 * 030 * @return The servlet context. 031 */ 032 ServletContext getServletContext(); 033 034 035 /** 036 * Returns the resource located at the named path as an input stream. 037 * Has the same behaviour as 038 * {@link javax.servlet.ServletContext#getResourceAsStream}. 039 * 040 * @param path The path to the resource, must be begin with a '/' and 041 * is interpreted as relative to the web application root. 042 * Must not be {@code null}. 043 * 044 * @return The resource as an input stream, or {@code null} if no 045 * resource exists at the specified path. 046 */ 047 InputStream getResourceAsStream(final String path); 048 049 050 /** 051 * Returns the Infinispan cache manager. 052 * 053 * @return The Infinispan cache manager. 054 */ 055 EmbeddedCacheManager getInfinispanCacheManager(); 056 057 058 /** 059 * Returns the OpenID Provider / Authorisation Server issuer URL. May 060 * be used to set the accepted audience values for SAML 2.0 or JWT 061 * bearer grant handlers. 062 * 063 * <p>Use {@link InvocationContext#getIssuer()} instead. 064 * 065 * @return The OpenID Provider / Authorisation Server issuer, 066 * {@code null} if not available (for a multi-tenant Connect2id 067 * server). 068 */ 069 @Deprecated 070 Issuer getIssuer(); 071 072 073 /** 074 * Returns the OpenID Provider / Authorisation Server issuer URL. May 075 * be used to set the accepted audience values for SAML 2.0 or JWT 076 * bearer grant handlers. 077 * 078 * <p>Use {@link InvocationContext#getIssuer()} instead. 079 * 080 * @return The OpenID Provider / Authorisation Server issuer, 081 * {@code null} if not available (for a multi-tenant Connect2id 082 * server). 083 */ 084 @Deprecated 085 Issuer getOPIssuer(); 086 087 088 /** 089 * Returns the token endpoint of the OpenID Provider / Authorisation 090 * Server. May be used to set the accepted audience values for SAML 2.0 091 * or JWT bearer grant handlers. 092 * 093 * @return The token endpoint URI, {@code null} if not available (for a 094 * multi-tenant Connect2id server). 095 */ 096 @Deprecated 097 URI getTokenEndpointURI(); 098 099 100 /** 101 * Returns a service context for accessing selected Connect2id server 102 * components that may be required in order to process claims or grant 103 * handler requests. The service context is only available during SPI 104 * request processing. Attempting to use it during SPI 105 * {@link Lifecycle#init ininitialisation} will produce an 106 * {@link IllegalStateException}. 107 * 108 * <p>Use {@link InvocationContext} instead. 109 * 110 * @return The service context. 111 */ 112 @Deprecated 113 ServiceContext getServiceContext(); 114} 115