* added cognito-idp initiate_auth and PASSWORD_VERIFIER challenge to respond_to_auth_challenge * fixed for python2 * added mfa, REFRESH_TOKEN to initiate_auth, SOFTWARE_TOKEN_MFA to respond_to_auth_challenge * added negative tests * test
61 lines
1.8 KiB
Python
61 lines
1.8 KiB
Python
from __future__ import unicode_literals
|
|
|
|
import json
|
|
from werkzeug.exceptions import BadRequest
|
|
from moto.core.exceptions import JsonRESTError
|
|
|
|
|
|
class ResourceNotFoundError(BadRequest):
|
|
def __init__(self, message):
|
|
super(ResourceNotFoundError, self).__init__()
|
|
self.description = json.dumps(
|
|
{"message": message, "__type": "ResourceNotFoundException"}
|
|
)
|
|
|
|
|
|
class UserNotFoundError(BadRequest):
|
|
def __init__(self, message):
|
|
super(UserNotFoundError, self).__init__()
|
|
self.description = json.dumps(
|
|
{"message": message, "__type": "UserNotFoundException"}
|
|
)
|
|
|
|
|
|
class UsernameExistsException(BadRequest):
|
|
def __init__(self, message):
|
|
super(UsernameExistsException, self).__init__()
|
|
self.description = json.dumps(
|
|
{"message": message, "__type": "UsernameExistsException"}
|
|
)
|
|
|
|
|
|
class GroupExistsException(BadRequest):
|
|
def __init__(self, message):
|
|
super(GroupExistsException, self).__init__()
|
|
self.description = json.dumps(
|
|
{"message": message, "__type": "GroupExistsException"}
|
|
)
|
|
|
|
|
|
class NotAuthorizedError(BadRequest):
|
|
def __init__(self, message):
|
|
super(NotAuthorizedError, self).__init__()
|
|
self.description = json.dumps(
|
|
{"message": message, "__type": "NotAuthorizedException"}
|
|
)
|
|
|
|
|
|
class UserNotConfirmedException(BadRequest):
|
|
def __init__(self, message):
|
|
super(UserNotConfirmedException, self).__init__()
|
|
self.description = json.dumps(
|
|
{"message": message, "__type": "UserNotConfirmedException"}
|
|
)
|
|
|
|
|
|
class InvalidParameterException(JsonRESTError):
|
|
def __init__(self, msg=None):
|
|
self.code = 400
|
|
super(InvalidParameterException, self).__init__(
|
|
"InvalidParameterException", msg or "A parameter is specified incorrectly."
|
|
)
|