def credentials_match(self, user_detail, key):
if user_detail:<EOL><INDENT>creds = user_detail.get('<STR_LIT>')<EOL>try:<EOL><INDENT>auth_encoder, creds_dict =swauth.authtypes.validate_creds(creds)<EOL><DEDENT>except ValueError as e:<EOL><INDENT>self.logger.error('<STR_LIT:%s>' % e.args[<NUM_LIT:0>])<EOL>return False<EOL><DEDENT><DEDENT>return user_detail and auth_encoder.match(key, creds, **creds_dict)<EOL>
Returns True if the key is valid for the user_detail.
        It will use auth_encoder type the password was encoded with,
        to check for a key match.

        :param user_detail: The dict for the user.
        :param key: The key to validate for the user.
        :returns: True if the key is valid for the user, False if not.