Example #1
0
        def decorated(*args, **kwargs):
            if not self.app.config.get("TESTING"):
                access_token = extract_access_token(request.headers)
                try:
                    self.token_service.verify(access_token)
                    self.claims = self.token_service.claims
                    g.cognito_claims = self.claims
                except TokenVerifyError as e:
                    _ = request.data
                    abort(make_response(jsonify(message=str(e)), 401))

            return view(*args, **kwargs)
        def decorated(*args, **kwargs):

            access_token = extract_access_token(request.headers)
            try:
                self.token_service.verify(access_token)
                self.claims = self.token_service.claims
                g.cognito_claims = self.claims
            except TokenVerifyError as e:
                _ = request.data
                ##Original - abort(make_response(jsonify(message=str(e)), 401))
                abort(401)
            return view(*args, **kwargs)
Example #3
0
        def decorated(*args, **kwargs):

            access_token = extract_access_token(request.headers)
            try:
                self.token_service.verify(access_token)
                self.claims = self.token_service.claims
                g.cognito_claims = self.claims
            except TokenVerifyError as e:
                _ = request.data
                # 2020-10-01 - Amazon addition
                # Purpose - fix HTTP return code
                # Original - abort(make_response(jsonify(message=str(e)), 401))
                abort(401)
                # End of Amazon addition
            return view(*args, **kwargs)
Example #4
0
        def decorated(*args, **kwargs):

            access_token = session.get('access_token')
            user = session.get('user')
            if access_token is None:
                access_token = extract_access_token(request.headers)
            else:
                user = session.get('user')
            try:
                self.token_service.verify(access_token)
                self.claims = self.token_service.claims
                self.user = user
                g.cognito_claims = self.claims
                g.user = self.user
            except TokenVerifyError as e:
                _ = request.data
                session.clear()
                #abort(make_response(render_template(self.template)), 401)
                return render_template(self.template, errorStr=str(e)), 401

            return view(*args, **kwargs)