public Subscription getSubscriptionFromRequest ( HttpServletRequest request ) { String tokenHeader = request . getHeader ( "Authorization" ) ; if ( tokenHeader == null || tokenHeader . indexOf ( "Token " ) != 0 ) { LOG . info ( "Empty authorizationheader, or header does not start with 'Token ': " + tokenHeader ) ; return null ; } String tokenValue = tokenHeader . substring ( tokenHeader . indexOf ( " " ) ) . trim ( ) ; LOG . info ( "Token value: " + tokenValue ) ; if ( tokenValue != null ) { return subscriptionService . findSubscriptionByAuthorizationToken ( tokenValue ) ; } return null ; }
Finds Subscription object based on request .