private String getAuthHash ( WebContext ctx ) { Value authorizationHeaderValue = ctx . getHeaderValue ( HttpHeaderNames . AUTHORIZATION ) ; if ( ! authorizationHeaderValue . isFilled ( ) ) { return ctx . get ( "Signature" ) . asString ( ctx . get ( "X-Amz-Signature" ) . asString ( ) ) ; } String authentication = Strings . isEmpty ( authorizationHeaderValue . getString ( ) ) ? "" : authorizationHeaderValue . getString ( ) ; Matcher m = AWS_AUTH_PATTERN . matcher ( authentication ) ; if ( m . matches ( ) ) { return m . group ( 2 ) ; } m = AWS_AUTH4_PATTERN . matcher ( authentication ) ; if ( m . matches ( ) ) { return m . group ( 7 ) ; } return null ; }
Extracts the given hash from the given request . Returns null if no hash was given .