protected List < String > resolveEventFromHttpRequest ( final HttpServletRequest request ) { val mfaRequestHeader = casProperties . getAuthn ( ) . getMfa ( ) . getRequestHeader ( ) ; val headers = request . getHeaders ( mfaRequestHeader ) ; if ( headers != null && headers . hasMoreElements ( ) ) { LOGGER . debug ( "Received request header [{}] as [{}]" , mfaRequestHeader , headers ) ; return Collections . list ( headers ) ; } val mfaRequestParameter = casProperties . getAuthn ( ) . getMfa ( ) . getRequestParameter ( ) ; val params = request . getParameterValues ( mfaRequestParameter ) ; if ( params != null && params . length > 0 ) { LOGGER . debug ( "Received request parameter [{}] as [{}]" , mfaRequestParameter , params ) ; return Arrays . stream ( params ) . collect ( Collectors . toList ( ) ) ; } val attributeName = casProperties . getAuthn ( ) . getMfa ( ) . getSessionAttribute ( ) ; val session = request . getSession ( false ) ; var attributeValue = session != null ? session . getAttribute ( attributeName ) : null ; if ( attributeValue == null ) { LOGGER . trace ( "No value could be found for session attribute [{}]. Checking request attributes..." , attributeName ) ; attributeValue = request . getAttribute ( attributeName ) ; } if ( attributeValue == null ) { LOGGER . trace ( "No value could be found for [{}]" , attributeName ) ; return null ; } val values = CollectionUtils . toCollection ( attributeValue ) ; LOGGER . debug ( "Found values [{}] mapped to attribute name [{}]" , values , attributeName ) ; return values . stream ( ) . map ( Object :: toString ) . collect ( Collectors . toList ( ) ) ; }
Resolve event from http request .