Class DBService2
- 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
-
- org.cilogon.oauth2.servlet.servlet.AbstractDBService
-
- org.cilogon.proxy.servlet.DBService2
-
- All Implemented Interfaces:
edu.uiuc.ncsa.security.core.Logable,Serializable,javax.servlet.Servlet,javax.servlet.ServletConfig,org.oa4mp.delegation.common.servlet.TransactionFilter
public class DBService2 extends AbstractDBService
Created by Jeff Gaynor
on 1/22/15 at 12:15 PM- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static StringCHECK_CODE_APPROVEDstatic intCHECK_CODE_APPROVED_CASEstatic StringCHECK_USER_CODEstatic intCHECK_USER_CODE_CASEstatic StringUSER_CODE_APPROVED_PARAMETERstatic StringUSER_CODE_PARAMETER-
Fields inherited from class org.cilogon.oauth2.servlet.servlet.AbstractDBService
ACTION_PARAMETER, AFFILIATION, ATTR_JSON, clientApprovalKeys, clientKeys, CREATE_TRANSACTION_STATE, CREATE_TRANSACTION_STATE_CASE, CREATE_USER, CREATE_USER_CASE, DISPLAY_NAME, distinguishedNameField, GET_ALL_IDPS, GET_ALL_IDPS_CASE, GET_CLIENT, GET_CLIENT_CASE, GET_LAST_ARCHIVED_USER, GET_LAST_ARCHIVED_USER_CASE, GET_PORTAL_PARAMETER, GET_PORTAL_PARAMETER_CASE, GET_TWO_FACTOR_INFO, GET_TWO_FACTOR_INFO_CASE, GET_USER, GET_USER_CASE, GET_USER_ID, GET_USER_ID_CASE, HAS_USER, HAS_USER_CASE, idpKeys, OU, REGISTERED_BY_INCOMMON, REMOVE_USER, REMOVE_USER_CASE, serializer, SET_ALL_IDPS, SET_ALL_IDPS_CASE, SET_TRANSACTION_STATE, SET_TRANSACTION_STATE_CASE, SET_TWO_FACTOR_INFO, SET_TWO_FACTOR_INFO_CASE, STATUS_CREATE_TRANSACTION_FAILED, STATUS_EXPIRED_TOKEN, STATUS_KEY, STATUS_MALFORMED_SCOPE, STATUS_MISSING_CLIENT_ID, STATUS_NO_CLIENT_FOUND, STATUS_NO_SCOPES, STATUS_QDL_ERROR, STATUS_QDL_RUNTIME_ERROR, STATUS_SERVICE_UNAVAILABLE, STATUS_TRANSACTION_NOT_FOUND, STATUS_UNAPPROVED_CLIENT, STATUS_UNKNOWN_CLIENT, tfKeys, UNRECOGNIZED_CASE, UPDATE_USER, UPDATE_USER_CASE, userKeys
-
Fields inherited from class org.oa4mp.server.api.storage.servlet.OA4MPServlet
caThread, kpt, lastAccessedThread, transactionCleanup
-
-
Constructor Summary
Constructors Constructor Description DBService2()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcheckUserCode(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)Taken from CIL-934 action: checkUserCode param: user_code (required, but can be empty)protected voidcreateTransaction(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)This accepts the following parametersprotected voiddoAction(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, String action)Override this to add more actions.protected voiddoError(String message, int errorCode, javax.servlet.http.HttpServletResponse resp)protected voiddoUserClaims(CILogonOA2ServiceEnvironment env, CILOA2ServiceTransaction t, javax.servlet.http.HttpServletRequest request, edu.uiuc.ncsa.security.core.util.MetaDebugUtil debugger)Runs the user claims to populate the transaction.protected voidgetClient(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)voidinit(javax.servlet.ServletConfig config)protected intlookupCase(String x)protected voidsetTransactionState(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)protected voiduserCodeApproved(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)action: userCodeApproved param(s):protected voidwriteClient(org.oa4mp.server.loader.oauth2.storage.clients.OA2Client client, int statusCode, javax.servlet.http.HttpServletResponse response)protected voidwriteMessage(javax.servlet.http.HttpServletResponse response, Err errResponse)protected voidwriteTransaction(org.oa4mp.server.loader.oauth2.storage.transactions.OA2ServiceTransaction oa2ServiceTransaction, int status, javax.servlet.http.HttpServletResponse response)protected voidwriteTransaction(org.oa4mp.server.loader.oauth2.storage.transactions.OA2ServiceTransaction oa2ServiceTransaction, Err errResponse, javax.servlet.http.HttpServletResponse response)-
Methods inherited from class org.cilogon.oauth2.servlet.servlet.AbstractDBService
checkAndArchiveUser, checkEquals, createUser, doIt, findUser, getAllIdps, getLastArchivedUser, getParam, getParam, getPortalParameter, getUser, getUserbyUID, getUserID, getUserNoIDP, getUserWithIDP, hasUser, init, isEmpty, OLDfindUser, parseUseUSinDNString, setAllIdps, setStatusOK, startWrite, stopWrite, updateUser, updateUserfromProperties, userLogic, verifyAndGet, write2FInfo, writeMessage, writeMessage, writeUser, writeUser
-
Methods inherited from class org.oa4mp.server.api.storage.servlet.OA4MPServlet
checkAdminClientStatus, checkClientApproval, createDebugger, destroy, getAGI, getATI, getClient, getClient, getClient, getFirstParameters, getFirstParameterValue, getGrantIDFromRequest, getServiceEnvironment, getTransaction, getTransactionByGrantID, getTransactionStore, loadProperties2, newTransaction, postprocess, preprocess, realStoreUpdates, say, shutdownCleanup, storeUpdates
-
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, doPing, doPost, error, error, getConfigurationLoader, getEnvironment, getExceptionHandler, getInitialization, getMyLogger, getRequestIPAddress, handleException, info, 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
-
CHECK_USER_CODE
public static final String CHECK_USER_CODE
- See Also:
- Constant Field Values
-
CHECK_USER_CODE_CASE
public static final int CHECK_USER_CODE_CASE
- See Also:
- Constant Field Values
-
CHECK_CODE_APPROVED
public static final String CHECK_CODE_APPROVED
- See Also:
- Constant Field Values
-
CHECK_CODE_APPROVED_CASE
public static final int CHECK_CODE_APPROVED_CASE
- See Also:
- Constant Field Values
-
USER_CODE_PARAMETER
public static final String USER_CODE_PARAMETER
- See Also:
- Constant Field Values
-
USER_CODE_APPROVED_PARAMETER
public static final String USER_CODE_APPROVED_PARAMETER
- See Also:
- Constant Field Values
-
-
Method Detail
-
init
public void init(javax.servlet.ServletConfig config) throws javax.servlet.ServletException- Specified by:
initin interfacejavax.servlet.Servlet- Overrides:
initin classjavax.servlet.GenericServlet- Throws:
javax.servlet.ServletException
-
doAction
protected void doAction(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, String action) throws IOException, javax.servlet.ServletExceptionDescription copied from class:AbstractDBServiceOverride this to add more actions.- Overrides:
doActionin classAbstractDBService- Throws:
IOExceptionjavax.servlet.ServletException
-
checkUserCode
protected void checkUserCode(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws IOExceptionTaken from CIL-934 action: checkUserCode param: user_code (required, but can be empty)Purpose: This is an "internal" dbService method used by the PHP web front end to (1) verify that a user_code input by the user is valid and (2) return the client_id associated with this transaction in order to display client information to the end user. The user_code parameter is required, but it can be empty. The user_code parameter can contain extra "user-friendly" characters such as dash '-', space ' ', underscore '_', etc. These extra characters will be stripped out/ignored by the dbService. The user_code can contain lower-case and/or upper-case characters which will be transformed to upper-case characters by the dbService. Returns: HTTP 200 response, body is basic text, one line per returned value:
status=INTEGER 0 = Success 1048569 = missing parameter 65537 = transaction not found 65539 = expired user_code (token) client_id=The OIDC client_id matching the user_code user_code=The original user_code to be displayed to the end user. The purpose of this is that the returned user_code should visually match the one that was returned to the device so the user can easily verify a match (i.e., ignore any transformations done by the user when inputting the user_code). scope=A (possibly empty/absent) space-separated list of scopes that were requested by the client. This is needed when displaying the list of attributes to be delegated since the scopes requested by the device client may differ from those registered.
- Parameters:
request-response-- Throws:
IOException
-
userCodeApproved
protected void userCodeApproved(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws IOExceptionaction: userCodeApproved param(s):user_code (required) approved (optional; defaults to 1; 1=approved; 0=denied)
Purpose: This is an "internal" dbService method used by the PHP web front end to let the dbService know that the user has logged on to their chosen Identity Provider and approved the transaction OR that the user has clicked a "Cancel" button and denied the transaction. If the user has approved the transaction (approved=1 or 'approved' is absent, the default), the OA4MP server can proceed with the rest of the Device authz grant flow. If the user has denied the transaction (approved=0), the OA4MP server should inform the device that the user has canceled the transaction. Returns: HTTP 200 response, body is basic text, one line per returned value:
status=INTEGER 0 = Success 1048569 = missing parameter 65537 = transaction not found
- Throws:
IOException
-
writeClient
protected void writeClient(org.oa4mp.server.loader.oauth2.storage.clients.OA2Client client, int statusCode, javax.servlet.http.HttpServletResponse response) throws IOException- Throws:
IOException
-
writeTransaction
protected void writeTransaction(org.oa4mp.server.loader.oauth2.storage.transactions.OA2ServiceTransaction oa2ServiceTransaction, int status, javax.servlet.http.HttpServletResponse response) throws IOException- Throws:
IOException
-
writeTransaction
protected void writeTransaction(org.oa4mp.server.loader.oauth2.storage.transactions.OA2ServiceTransaction oa2ServiceTransaction, Err errResponse, javax.servlet.http.HttpServletResponse response) throws IOException- Throws:
IOException
-
doError
protected void doError(String message, int errorCode, javax.servlet.http.HttpServletResponse resp) throws IOException
- Throws:
IOException
-
createTransaction
protected void createTransaction(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) throws IOExceptionThis accepts the following parametersclient_id scopes state code_challenge (RFC 7636) code_challenge_method " "
and the response- Parameters:
req-resp-- Throws:
IOException
-
writeMessage
protected void writeMessage(javax.servlet.http.HttpServletResponse response, Err errResponse) throws IOException- Throws:
IOException
-
setTransactionState
protected void setTransactionState(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) throws IOException- Throws:
IOException
-
doUserClaims
protected void doUserClaims(CILogonOA2ServiceEnvironment env, CILOA2ServiceTransaction t, javax.servlet.http.HttpServletRequest request, edu.uiuc.ncsa.security.core.util.MetaDebugUtil debugger) throws Throwable
Runs the user claims to populate the transaction.- Parameters:
env-t-request-debugger-- Throws:
Throwable
-
getClient
protected void getClient(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) throws IOException- Throws:
IOException
-
lookupCase
protected int lookupCase(String x)
- Overrides:
lookupCasein classAbstractDBService
-
-