def test_claims_supported_not_set(self):
        """
        If OIDC_CLAIMS_SUPPORTED is not set in settings.py, the claims_supported
        entry is an empty list
        """
        request = self.factory.get(self.url)

        response = ProviderInfoView.as_view()(request)
        dic = json.loads(response.content.decode('utf-8'))
        self.assertEqual(dic['claims_supported'], [])
    def test_response(self):
        """
        See if the endpoint is returning the corresponding
        server information by checking status, content type, etc.
        """

        request = self.factory.get(self.url)

        response = ProviderInfoView.as_view()(request)

        self.assertEqual(response.status_code, 200)
        self.assertEqual(response['Content-Type'] == 'application/json', True)
        self.assertEqual(bool(response.content), True)
    def test_response(self):
        """
        See if the endpoint is returning the corresponding
        server information by checking status, content type, etc.
        """
        url = reverse('oidc_provider:provider-info')

        request = self.factory.get(url)

        response = ProviderInfoView.as_view()(request)

        self.assertEqual(response.status_code, 200)
        self.assertEqual(response['Content-Type'] == 'application/json', True)
        self.assertEqual(bool(response.content), True)
    def test_expected_keys_in_response(self):
        """
        Test that response contains all ncecessary keys
        """
        required_keys = {
            'issuer',
            'authorization_endpoint',
            'token_endpoint',
            'userinfo_endpoint',
            'end_session_endpoint',
            'introspection_endpoint',
            'response_types_supported',
            'jwks_uri',
            'id_token_signing_alg_values_supported',
            'subject_types_supported',
            'token_endpoint_auth_methods_supported',
            'claims_supported',
        }

        request = self.factory.get(self.url)

        response = ProviderInfoView.as_view()(request)
        resp_keys = set(json.loads(response.content.decode('utf-8')).keys())
        self.assertEqual(required_keys, resp_keys)
Ejemplo n.º 5
0
         TunnistamoAuthorizationView.as_view(),
         name="oauth2_authorize"),
    path('oauth2/', include(oauth2_provider.urls,
                            namespace='oauth2_provider')),
    re_path(r'^openid/authorize/?$',
            TunnistamoOidcAuthorizeView.as_view(),
            name='authorize'),
    re_path(r'^openid/end-session/?$',
            TunnistamoOidcEndSessionView.as_view(),
            name='end-session'),
    re_path(r'^openid/token/?$',
            csrf_exempt(TunnistamoOidcTokenView.as_view()),
            name='token'),
    path('openid/', include(oidc_provider.urls, namespace='oidc_provider')),
    re_path(r'^\.well-known/openid-configuration/?$',
            OIDCProviderInfoView.as_view(),
            name='root-provider-info'),
    re_path(r'^user/(?P<username>[\w.@+-]+)/?$', UserView.as_view()),
    path('user/', UserView.as_view()),
    path('jwt-token/', GetJWTView.as_view()),
    path('login/', LoginView.as_view()),
    path('logout/', LogoutView.as_view()),
    v1_api_path,
    path(
        'docs/',
        include_docs_urls(title='Tunnistamo API v1',
                          patterns=[v1_api_path],
                          generator_class=AllEnglishSchemaGenerator)),
]

if settings.DEBUG:
Ejemplo n.º 6
0
    path('admin/', admin.site.urls),
    path('admin/report/', staff_member_required(ReportView.as_view())),
    path('api-tokens/', get_api_tokens_view),
    path('accounts/profile/', show_login),
    path('accounts/login/', LoginView.as_view()),
    path('accounts/logout/', AuthoritativeLogoutRedirectView.as_view()),
    path('accounts/', include(auth_backends.urls, namespace='auth_backends')),
    path('accounts/', include(social_auth_urls, namespace='social')),
    path('oauth2/applications/', permission_denied),
    path('oauth2/authorize/', TunnistamoAuthorizationView.as_view(), name="oauth2_authorize"),
    path('oauth2/', include(oauth2_provider.urls, namespace='oauth2_provider')),
    re_path(r'^openid/authorize/?$', TunnistamoOidcAuthorizeView.as_view(), name='authorize'),
    re_path(r'^openid/end-session/?$', TunnistamoOidcEndSessionView.as_view(), name='end-session'),
    re_path(r'^openid/token/?$', csrf_exempt(TunnistamoOidcTokenView.as_view()), name='token'),
    path('openid/', include(oidc_provider.urls, namespace='oidc_provider')),
    re_path(r'^\.well-known/openid-configuration/?$', OIDCProviderInfoView.as_view(), name='root-provider-info'),
    re_path(r'^user/(?P<username>[\w.@+-]+)/?$', UserView.as_view()),
    path('user/', UserView.as_view()),
    path('jwt-token/', GetJWTView.as_view()),
    path('login/', LoginView.as_view()),
    path('logout/', AuthoritativeLogoutRedirectView.as_view()),
    v1_api_path,
    path('docs/', include_docs_urls(title='Tunnistamo API v1', patterns=[v1_api_path],
                                    generator_class=AllEnglishSchemaGenerator)),
]

if settings.DEBUG:
    static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)


#
Ejemplo n.º 7
0
v1_api_path = path('v1/', include((router.urls + [v1_scope_path], 'v1')))

urlpatterns = [
    path('admin/', admin.site.urls),
    path('api-tokens/', get_api_tokens_view),
    path('accounts/profile/', show_login),
    path('accounts/login/', LoginView.as_view()),
    path('accounts/logout/', LogoutView.as_view()),
    path('accounts/', include(auth_backends.urls, namespace='auth_backends')),
    path('accounts/', include(social_auth_urls, namespace='social')),
    path('oauth2/applications/', permission_denied),
    path('oauth2/authorize/', TunnistamoAuthorizationView.as_view(), name="oauth2_authorize"),
    path('oauth2/', include(oauth2_provider.urls, namespace='oauth2_provider')),
    re_path(r'^openid/authorize/?$', TunnistamoOidcAuthorizeView.as_view(), name='authorize'),
    re_path(r'^openid/end-session/?$', TunnistamoOidcEndSessionView.as_view(), name='end-session'),
    path('openid/', include(oidc_provider.urls, namespace='oidc_provider')),
    re_path(r'^\.well-known/openid-configuration/?$', OIDCProviderInfoView.as_view(), name='root-provider-info'),
    re_path(r'^user/(?P<username>[\w.@+-]+)/?$', UserView.as_view()),
    path('user/', UserView.as_view()),
    path('jwt-token/', GetJWTView.as_view()),
    path('login/', LoginView.as_view()),
    path('logout/', LogoutView.as_view()),
    path('email-needed/', EmailNeededView.as_view(), name='email_needed'),
    v1_api_path,
    path('docs/', include_docs_urls(title='Tunnistamo API v1', patterns=[v1_api_path],
                                    generator_class=AllEnglishSchemaGenerator)),
]

if settings.DEBUG:
    static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)