Skip to content
This repository was archived by the owner on Sep 29, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions adal.pyproj
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@
<Compile Include="adal\__init__.py">
<SubType>Code</SubType>
</Compile>
<Compile Include="sample\certificate_credentials_sample.py" />
<Compile Include="sample\client_credentials_sample.py" />
<Compile Include="sample\device_code_sample.py" />
<Compile Include="sample\refresh_token_sample.py" />
<Compile Include="sample\website_sample.py" />
<Compile Include="setup.py">
<SubType>Code</SubType>
</Compile>
Expand All @@ -105,6 +110,7 @@
</ItemGroup>
<ItemGroup>
<Folder Include="adal\" />
<Folder Include="sample\" />
<Folder Include="tests\" />
<Folder Include="tests\data\" />
<Folder Include="tests\mex\" />
Expand Down
10 changes: 7 additions & 3 deletions adal/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,18 @@
#
#------------------------------------------------------------------------------

__version__ = '0.2.0'
__version__ = '1.0.0rc1'

from .authentication_context import AuthenticationContext
from .token_cache import TokenCache
from .log import LOGGING_LEVEL, set_logging_options, get_logging_options
from .log import (LOGGING_LEVEL,
set_logging_options,
get_logging_options,
ADAL_LOGGER_NAME)
from .adal_error import AdalError

# to avoid "No handler found" warnings.
import logging
logging.getLogger(log.ADAL_LOGGER_NAME).addHandler(logging.NullHandler())
logging.getLogger(ADAL_LOGGER_NAME).addHandler(logging.NullHandler())


29 changes: 28 additions & 1 deletion adal/adal_error.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,31 @@
class AdalError(Exception):
#------------------------------------------------------------------------------
#
# Copyright (c) Microsoft Corporation.
# All rights reserved.
#
# This code is licensed under the MIT License.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files(the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions :
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
#------------------------------------------------------------------------------

class AdalError(Exception):
def __init__(self, error_msg, error_response=None):
super(AdalError, self).__init__(error_msg)
self.error_response = error_response
10 changes: 8 additions & 2 deletions adal/argument.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,21 @@
# THE SOFTWARE.
#
#------------------------------------------------------------------------------
import sys

from .constants import OAuth2DeviceCodeResponseParameters

def validate_string_param(value, name):

if not value:
raise ValueError("The {0} parameter is required".format(name))

if not isinstance(value, str):
result = True
if sys.version_info.major < 3:
result = isinstance(value, basestring)
else:
result = isinstance(value, str)

if not result:
raise TypeError("The {0} parameter must be of type str".format(name))

def validate_user_code_info(user_code_info):
Expand Down
Loading