Class OA4MPServlet
- java.lang.Object
-
- javax.servlet.GenericServlet
-
- javax.servlet.http.HttpServlet
-
- edu.uiuc.ncsa.security.servlet.AbstractServlet
-
- org.oa4mp.server.api.storage.servlet.EnvServlet
-
- org.oa4mp.server.api.storage.servlet.OA4MPServlet
-
- All Implemented Interfaces:
edu.uiuc.ncsa.security.core.Logable,Serializable,javax.servlet.Servlet,javax.servlet.ServletConfig,org.oa4mp.delegation.common.servlet.TransactionFilter
- Direct Known Subclasses:
AbstractAccessTokenServlet,AbstractAuthenticationServlet,AbstractCertServlet,AbstractInitServlet,AbstractRegistrationServlet,AuthorizationControllerServlet,DiscoveryServlet,ErrorServlet
public abstract class OA4MPServlet extends EnvServlet implements org.oa4mp.delegation.common.servlet.TransactionFilter
Created by Jeff Gaynor
on May 17, 2011 at 3:46:53 PM- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static AbstractCLIApprover.ClientApprovalThreadcaThreadstatic edu.uiuc.ncsa.security.util.pkcs.KeyPairPopulationThreadkptstatic edu.uiuc.ncsa.security.storage.events.LastAccessedThreadlastAccessedThreadstatic edu.uiuc.ncsa.security.core.cache.Cleanup<String,org.oa4mp.delegation.common.storage.transactions.BasicTransaction>transactionCleanup-
Fields inherited from class org.oa4mp.server.api.storage.servlet.EnvServlet
ERROR_NOTIFICATION_BODY_KEY, ERROR_NOTIFICATION_SUBJECT_KEY, notificationListeners, storeUpdatesDone
-
-
Constructor Summary
Constructors Constructor Description OA4MPServlet()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidcheckAdminClientStatus(edu.uiuc.ncsa.security.core.Identifier clientID)Given a client id, check if there is an associated admin client and if so, check the status of said admin client.voidcheckClientApproval(org.oa4mp.delegation.common.storage.clients.BaseClient client)Checks if the client is approved.static edu.uiuc.ncsa.security.core.util.MetaDebugUtilcreateDebugger(org.oa4mp.delegation.common.storage.clients.BaseClient client)voiddestroy()AGIssuergetAGI()protected ATIssuergetATI()org.oa4mp.delegation.common.storage.clients.ClientgetClient(edu.uiuc.ncsa.security.core.Identifier identifier)org.oa4mp.delegation.common.storage.clients.ClientgetClient(javax.servlet.http.HttpServletRequest req)Assumes that the client identifier is a parameter in the request.protected org.oa4mp.delegation.common.storage.clients.ClientgetClient(org.oa4mp.delegation.common.token.AuthorizationGrant authorizationGrant)A utility to get the client from the authorization grant.static Map<String,String>getFirstParameters(javax.servlet.http.HttpServletRequest req)Utility to extract all of the parameters from a request.StringgetFirstParameterValue(javax.servlet.http.HttpServletRequest req, String key)Gets the first values of the parameter with the give key or null if no such value.protected edu.uiuc.ncsa.security.core.IdentifiergetGrantIDFromRequest(javax.servlet.http.HttpServletRequest req)static ServiceEnvironmentgetServiceEnvironment()protected ServiceTransactiongetTransaction(org.oa4mp.delegation.common.token.AuthorizationGrant grant)protected ServiceTransactiongetTransactionByGrantID(javax.servlet.http.HttpServletRequest request)org.oa4mp.delegation.common.storage.TransactionStoregetTransactionStore()protected booleanisEmpty(String x)ServiceEnvironmentImplloadProperties2()ServiceTransactionnewTransaction()voidpostprocess(org.oa4mp.delegation.common.servlet.TransactionState state)voidpreprocess(org.oa4mp.delegation.common.servlet.TransactionState state)Note that if you override this, you should call super, which sets some security-related headers, but touches nothing else.protected voidrealStoreUpdates()If you have store updates that need to get done, put them in this method, invoking super.voidsay(String x)Just for low-level debugging.protected voidshutdownCleanup(edu.uiuc.ncsa.security.core.cache.Cleanup c)voidstoreUpdates()This will be invoked at init before anything else and should include code to seamlessly upgrade stores from earlier versions.abstract ServiceTransactionverifyAndGet(IssuerResponse iResponse)This is called after the response is received so that the system can get the approproate transaction.-
Methods inherited from class org.oa4mp.server.api.storage.servlet.EnvServlet
addNotificationListener, loadEnvironment, processStoreCheck, removeNotificationListener
-
Methods inherited from class edu.uiuc.ncsa.security.servlet.AbstractServlet
checkContentType, CONST, debug, doGet, doIt, doPing, doPost, error, error, getConfigurationLoader, getEnvironment, getExceptionHandler, getInitialization, getMyLogger, getRequestIPAddress, handleException, info, init, isDebugOn, logOK, logOK, printAllParameters, printAllParameters, resetState, setConfigurationLoader, setDebugOn, setEnvironment, setExceptionHandler, setInitialization, warn
-
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service
-
-
-
-
Field Detail
-
transactionCleanup
public static edu.uiuc.ncsa.security.core.cache.Cleanup<String,org.oa4mp.delegation.common.storage.transactions.BasicTransaction> transactionCleanup
-
lastAccessedThread
public static edu.uiuc.ncsa.security.storage.events.LastAccessedThread lastAccessedThread
-
kpt
public static edu.uiuc.ncsa.security.util.pkcs.KeyPairPopulationThread kpt
-
caThread
public static AbstractCLIApprover.ClientApprovalThread caThread
-
-
Method Detail
-
createDebugger
public static edu.uiuc.ncsa.security.core.util.MetaDebugUtil createDebugger(org.oa4mp.delegation.common.storage.clients.BaseClient client)
-
verifyAndGet
public abstract ServiceTransaction verifyAndGet(IssuerResponse iResponse) throws IOException
This is called after the response is received so that the system can get the approproate transaction. Checks for the validity of the transaction should be done here too.- Parameters:
iResponse-- Returns:
- Throws:
IOException
-
loadProperties2
public ServiceEnvironmentImpl loadProperties2() throws IOException
- Overrides:
loadProperties2in classEnvServlet- Throws:
IOException
-
getAGI
public AGIssuer getAGI() throws IOException
- Throws:
IOException
-
getATI
protected ATIssuer getATI() throws IOException
- Throws:
IOException
-
getServiceEnvironment
public static ServiceEnvironment getServiceEnvironment()
-
storeUpdates
public void storeUpdates() throws IOException, SQLExceptionDescription copied from class:EnvServletThis will be invoked at init before anything else and should include code to seamlessly upgrade stores from earlier versions. For instance, if a new column needs to be added to a table. This pre-supposes that the current user has the correct permissions to alter the table, btw. This also updates the internal flagEnvServlet.storeUpdatesDonewhich should be checks in overrides. If you override this method and call super, let super manage this flag. If it is true, do not execute your method.- Specified by:
storeUpdatesin classEnvServlet- Throws:
IOExceptionSQLException
-
realStoreUpdates
protected void realStoreUpdates() throws IOException, SQLExceptionIf you have store updates that need to get done, put them in this method, invoking super. Calls to this are managed by the servlet to make sure nothing get called more than once.- Throws:
IOExceptionSQLException
-
shutdownCleanup
protected void shutdownCleanup(edu.uiuc.ncsa.security.core.cache.Cleanup c)
-
destroy
public void destroy()
- Specified by:
destroyin interfacejavax.servlet.Servlet- Overrides:
destroyin classjavax.servlet.GenericServlet
-
getTransactionStore
public org.oa4mp.delegation.common.storage.TransactionStore getTransactionStore() throws IOException- Throws:
IOException
-
getClient
public org.oa4mp.delegation.common.storage.clients.Client getClient(javax.servlet.http.HttpServletRequest req)
Assumes that the client identifier is a parameter in the request.- Parameters:
req-- Returns:
-
getTransactionByGrantID
protected ServiceTransaction getTransactionByGrantID(javax.servlet.http.HttpServletRequest request) throws IOException
- Throws:
IOException
-
getGrantIDFromRequest
protected edu.uiuc.ncsa.security.core.Identifier getGrantIDFromRequest(javax.servlet.http.HttpServletRequest req)
-
getClient
public org.oa4mp.delegation.common.storage.clients.Client getClient(edu.uiuc.ncsa.security.core.Identifier identifier)
-
newTransaction
public ServiceTransaction newTransaction() throws IOException
- Throws:
IOException
-
getTransaction
protected ServiceTransaction getTransaction(org.oa4mp.delegation.common.token.AuthorizationGrant grant) throws IOException
- Throws:
IOException
-
getClient
protected org.oa4mp.delegation.common.storage.clients.Client getClient(org.oa4mp.delegation.common.token.AuthorizationGrant authorizationGrant) throws IOExceptionA utility to get the client from the authorization grant. This looks up the transaction- Parameters:
authorizationGrant-- Returns:
- Throws:
IOException
-
checkClientApproval
public void checkClientApproval(org.oa4mp.delegation.common.storage.clients.BaseClient client)
Checks if the client is approved. This should be done before each leg of the process- Parameters:
client-
-
isEmpty
protected boolean isEmpty(String x)
-
preprocess
public void preprocess(org.oa4mp.delegation.common.servlet.TransactionState state) throws ThrowableNote that if you override this, you should call super, which sets some security-related headers, but touches nothing else.- Specified by:
preprocessin interfaceorg.oa4mp.delegation.common.servlet.TransactionFilter- Parameters:
state-- Throws:
Throwable
-
postprocess
public void postprocess(org.oa4mp.delegation.common.servlet.TransactionState state) throws Throwable- Specified by:
postprocessin interfaceorg.oa4mp.delegation.common.servlet.TransactionFilter- Throws:
Throwable
-
getFirstParameters
public static Map<String,String> getFirstParameters(javax.servlet.http.HttpServletRequest req)
Utility to extract all of the parameters from a request. Since the parameters are all string arrays, this takes a little finagling. Generally we do not support multiple values for parameters, so taking the first is reasonable.- Parameters:
req-- Returns:
-
getFirstParameterValue
public String getFirstParameterValue(javax.servlet.http.HttpServletRequest req, String key)
Gets the first values of the parameter with the give key or null if no such value.- Parameters:
req-key-- Returns:
-
say
public void say(String x)
Just for low-level debugging.- Parameters:
x-
-
checkAdminClientStatus
public void checkAdminClientStatus(edu.uiuc.ncsa.security.core.Identifier clientID)
Given a client id, check if there is an associated admin client and if so, check the status of said admin client. This way if an admin client has been revoked, e.g., all clients are immediately invalidated. This returns no value, it simply throws an exception if the admin client is invalid.- Parameters:
clientID-
-
-