public void sessionCheck ( HttpServletRequest req ) { String authHeader = req . getHeader ( "Authorization" ) ; if ( authHeader != null && this . validationSessionCheck ( authHeader ) ) { return ; } if ( req . getCookies ( ) != null ) { Cookie cookie = Arrays . stream ( req . getCookies ( ) ) . filter ( ck -> ck . getName ( ) . equals ( "AuthToken" ) ) . findFirst ( ) . orElse ( null ) ; if ( cookie != null && this . validationSessionCheck ( cookie . getValue ( ) ) ) { return ; } } if ( req . getParameter ( "token" ) != null ) { String token = req . getParameter ( "token" ) ; if ( this . validationSessionCheck ( token ) ) { return ; } } throw new ValidationLibException ( "UnAuthorization" , HttpStatus . UNAUTHORIZED ) ; }
Session check .