コード例 #1
0
    def auth_complete(self, *args, **kwargs):
        """Completes login process, must return user instance"""
        sessionID = self.strategy.session_get("ymsessionID")
        if not sessionID:
            raise AuthStateMissing(self, "Missing Session ID.")

        response = self.call_api("Member.Profile.Get",
                                 sessionID)  # fetch user data
        kwargs.update({'response': response, 'backend': self})
        return self.strategy.authenticate(*args, **kwargs)
コード例 #2
0
ファイル: oauth.py プロジェクト: gustanas/DilemmeWeb
 def validate_state(self):
     """Validate state value. Raises exception on error, returns state
     value if valid."""
     if not self.STATE_PARAMETER and not self.REDIRECT_STATE:
         return None
     state = self.get_session_state()
     request_state = self.get_request_state()
     if not request_state:
         raise AuthMissingParameter(self, 'state')
     elif not state:
         raise AuthStateMissing(self, 'state')
     elif not request_state == state:
         raise AuthStateForbidden(self)
     else:
         return state
コード例 #3
0
 def validate_state(self):
     """Validate state value. Raises exception on error, returns state
     value if valid."""
     if not self.STATE_PARAMETER and not self.REDIRECT_STATE:
         return None
     state = self.strategy.session_get(self.name + '_state')
     if state:
         request_state = self.data.get('state') or \
                         self.data.get('redirect_state')
         if not request_state:
             raise AuthMissingParameter(self, 'state')
         elif not state:
             raise AuthStateMissing(self, 'state')
         elif not request_state == state:
             raise AuthStateForbidden(self)
     return state
コード例 #4
0
ファイル: __init__.py プロジェクト: gmerzu/social.eusign
    def validate_state(self):
        """Validate state value. Raises exception on error, returns state
        value if valid."""
        state = self.strategy.session_get(self.name + '_state')
        request_state = self.data.get('state')
        if request_state and isinstance(request_state, list):
            request_state = request_state[0]

        if not request_state:
            raise AuthMissingParameter(self, 'state')
        elif not state:
            raise AuthStateMissing(self, 'state')
        elif not request_state == state:
            raise AuthStateForbidden(self)
        else:
            return state
コード例 #5
0
ファイル: test_exceptions.py プロジェクト: lugnitdgp/avskr2.0
class AuthStateMissingTest(BaseExceptionTestCase):
    exception = AuthStateMissing('foobar')
    expected_message = 'Session value state missing.'