from oic.oic.message import AuthorizationResponse
from oic.utils.time_util import utc_time_sans_frac
from oic.utils.keyio import KeyBundle
from oic.utils.keyio import KeyJar
from oic.utils.keyio import rsa_load

from fakeoicsrv import MyFakeOICServer

__author__ = 'rohe0002'

KC_SYM_S = KeyBundle(
        {"kty": "oct", "key": "abcdefghijklmnop".encode("utf-8"), "use": "sig",
         "alg": "HS256"})

BASE_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), "data/keys"))
_key = rsa_load(os.path.join(BASE_PATH, "rsa.key"))
KC_RSA = KeyBundle({"key": _key, "kty": "RSA", "use": "sig"})

KEYJ = KeyJar()
KEYJ[""] = [KC_RSA, KC_SYM_S]
KEYJ["client_1"] = [KC_RSA, KC_SYM_S]

CLIENT_ID = "client_1"
IDTOKEN = IdToken(iss="http://oic.example.org/", sub="sub",
                  aud=CLIENT_ID, exp=utc_time_sans_frac() + 86400,
                  nonce="N0nce",
                  iat=time.time())


def _eq(l1, l2):
    return set(l1) == set(l2)
Beispiel #2
0
from fakeoicsrv import MyFakeOICServer


def _eq(l1, l2):
    s1 = set(l1)
    s2 = set(l2)
    return s1 == s2


CLIENT_SECRET = "abcdefghijklmnop"
CLIENT_ID = "client_1"

KC_SYM_S = KeyBundle({"kty": "oct", "key": "abcdefghijklmnop", "use": "sig"})

_key = rsa_load("../oidc_example/op1/certs/mycert.key")
KC_RSA = KeyBundle({"key": _key, "kty": "RSA", "use": "sig"})

KEYJ = KeyJar()
KEYJ[""] = [KC_RSA, KC_SYM_S]
KEYJ["client_1"] = [KC_SYM_S]

IDTOKEN = IdToken(iss="http://oic.example.org/",
                  sub="sub",
                  aud=CLIENT_ID,
                  exp=utc_time_sans_frac() + 86400,
                  nonce="N0nce",
                  iat=time.time())

# ----------------- CLIENT --------------------
Beispiel #3
0
from oic.oauth2 import Client
from oic.oauth2 import AccessTokenRequest
from oic.utils.authn.user import UsernamePasswordMako
from oic.utils.keyio import KeyBundle
from oic.utils.keyio import rsa_load

__author__ = 'rolandh'

PASSWD = {"user": "******"}

ROOT = '../oidc_example/op1/'
tl = TemplateLookup(directories=[ROOT + 'templates', ROOT + 'htdocs'],
                    module_directory=ROOT + 'modules',
                    input_encoding='utf-8', output_encoding='utf-8')

_key = rsa_load("%s/certs/mycert.key" % ROOT)

KC_RSA = KeyBundle([{"key": _key, "kty": "RSA", "use": "ver"},
                    {"key": _key, "kty": "RSA", "use": "sig"}])


def create_return_form_env(user, password, query):
    _dict = {
        "login": user,
        "password": password,
        "query": query
    }

    return urllib.urlencode(_dict)

Beispiel #4
0
from oic.oauth2 import Client
from oic.oauth2 import AccessTokenRequest
from oic.utils.authn.user import UsernamePasswordMako
from oic.utils.keyio import KeyBundle
from oic.utils.keyio import rsa_load

__author__ = 'rolandh'

PASSWD = {"user": "******"}

ROOT = '../oc3/'
tl = TemplateLookup(directories=[ROOT + 'templates', ROOT + 'htdocs'],
                    module_directory=ROOT + 'modules',
                    input_encoding='utf-8', output_encoding='utf-8')

_key = rsa_load("../oc3/certs/mycert.key")
KC_RSA = KeyBundle([{"key": _key, "kty": "RSA", "use": "ver"},
                    {"key": _key, "kty": "RSA", "use": "sig"}])


def create_return_form_env(user, password, query):
    _dict = {
        "login": user,
        "password": password,
        "query": query
    }

    return urllib.urlencode(_dict)


class SRV(object):
Beispiel #5
0
from oic.utils.keyio import KeyJar
from oic.utils.keyio import rsa_load
from oic.utils.time_util import utc_time_sans_frac

__author__ = "rohe0002"

KC_SYM_S = KeyBundle({
    "kty": "oct",
    "key": "abcdefghijklmnop".encode("utf-8"),
    "use": "sig",
    "alg": "HS256",
})

BASE_PATH = os.path.abspath(
    os.path.join(os.path.dirname(__file__), "data/keys"))
_key = rsa_load(os.path.join(BASE_PATH, "rsa.key"))
KC_RSA = KeyBundle({"key": _key, "kty": "RSA", "use": "sig"})

KEYJ = KeyJar()
KEYJ[""] = [KC_RSA, KC_SYM_S]
KEYJ["client_1"] = [KC_RSA, KC_SYM_S]

CLIENT_ID = "client_1"
IDTOKEN = IdToken(
    iss="http://oic.example.org/",
    sub="sub",
    aud=CLIENT_ID,
    exp=utc_time_sans_frac() + 86400,
    nonce="N0nce",
    iat=time.time(),
)
Beispiel #6
0
from oic.utils import time_util
from oic.utils.time_util import utc_time_sans_frac
from oic.utils.keyio import KeyBundle, KeyJar, rsa_load
from fakeoicsrv import MyFakeOICServer
from utils_for_tests import _eq


CLIENT_SECRET = "abcdefghijklmnop"
CLIENT_ID = "client_1"

KC_SYM_S = KeyBundle({"kty": "oct", "key": "abcdefghijklmnop", "use": "sig",
                      "alg": "HS256"})

BASE_PATH = os.path.dirname(os.path.abspath(__file__))

_key = rsa_load("%s/rsa.key" % BASE_PATH)
KC_RSA = KeyBundle({"key": _key, "kty": "RSA", "use": "sig"})

KEYJ = KeyJar()
KEYJ[""] = [KC_RSA, KC_SYM_S]
KEYJ["client_1"] = [KC_SYM_S]

IDTOKEN = IdToken(iss="http://oic.example.org/", sub="sub",
                  aud=CLIENT_ID, exp=utc_time_sans_frac() + 86400,
                  nonce="N0nce",
                  iat=time.time())

# ----------------- CLIENT --------------------


class TestOICClient():
Beispiel #7
0
from oic.utils.keyio import rsa_load
from utils_for_tests import URLObject, _eq

__author__ = 'rolandh'

PASSWD = {"user": "******"}

BASE_PATH = os.path.dirname(os.path.abspath(__file__))

ROOT = '%s/../oidc_example/op2/' % BASE_PATH
tl = TemplateLookup(directories=[ROOT + 'templates', ROOT + 'htdocs'],
                    module_directory=ROOT + 'modules',
                    input_encoding='utf-8',
                    output_encoding='utf-8')

_key = rsa_load("%s/rsa.key" % BASE_PATH)

KC_RSA = KeyBundle([{
    "key": _key,
    "kty": "RSA",
    "use": "ver"
}, {
    "key": _key,
    "kty": "RSA",
    "use": "sig"
}])


def create_return_form_env(user, password, query):
    _dict = {"login": user, "password": password, "query": query}
Beispiel #8
0
from fakeoicsrv import MyFakeOICServer


def _eq(l1, l2):
    s1 = set(l1)
    s2 = set(l2)
    return s1 == s2


CLIENT_SECRET = "abcdefghijklmnop"
CLIENT_ID = "client_1"

KC_SYM_S = KeyBundle({"kty": "oct", "key": "abcdefghijklmnop", "use": "sig"})

_key = rsa_load("../oidc_example/op1/certs/mycert.key")
KC_RSA = KeyBundle({"key": _key, "kty": "RSA", "use": "sig"})

KEYJ = KeyJar()
KEYJ[""] = [KC_RSA, KC_SYM_S]
KEYJ["client_1"] = [KC_SYM_S]

IDTOKEN = IdToken(iss="http://oic.example.org/", sub="sub",
                  aud=CLIENT_ID, exp=utc_time_sans_frac() + 86400,
                  nonce="N0nce",
                  iat=time.time())

# ----------------- CLIENT --------------------


class TestOICClient():