Skip to content
Snippets Groups Projects
Select Git revision
  • master
  • dev protected
  • Issue/3006-changeApplicationProfileToMetadataProfile
  • Issue/3057-fix404InAims
  • Issue/3000-fixRemovingOfApInAims
  • Issue/2315-improveErrorCommunication
  • Hotfix/2957-styleAndUpgrade
  • Issue/2943-uiFeedback
  • Issue/2599-vue3Migration
  • Issue/xxxx-qualifiedShapeRedo
  • Issue/2779-correctFallback
  • Issue/2759-showMissingField
  • Issue/2703-vocabularyList
  • Issue/xxxx-searchEnhancements
  • Issue/xxxx-rdfEditor
  • Issue/2732-updatedApiClient
  • Issue/2525-fixedFixValues
  • Hotfix/2681-validationErrors
  • Issue/xxxx-excludeModuleAPs
  • APIv2
  • v3.0.8
  • v3.0.7
  • v3.0.6
  • v3.0.5
  • v3.0.4
  • v3.0.3
  • v3.0.2
  • v3.0.1
  • v3.0.0
  • v2.23.0
  • v2.22.1
  • v2.22.0
  • v2.21.0
  • v2.20.1
  • v2.20.0
  • v2.19.6
  • v2.19.5
  • v2.19.4
  • v2.19.3
  • v2.19.2
40 results

.eslintrc.js

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    urls.py 3.18 KiB
    from django.conf import settings
    from django.contrib import admin
    from django.shortcuts import redirect, render
    from django.urls import include, path, re_path
    from django.views.static import serve  
    from drf_yasg import openapi
    from drf_yasg.views import get_schema_view
    from rest_framework import permissions
    
    import os
    
    from ssoauth import views
    
    schema_view = get_schema_view(
        openapi.Info(
            title="Polaris Rights Engine Documentation",
            default_version="v1",
            description="REST API Documentation",
            terms_of_service="",
            contact=openapi.Contact(email=""),
            license=openapi.License(name=" License"),
        ),
        public=True,
        permission_classes=[permissions.AllowAny],
    )
    
    def detect_lang_redirect(request):
        #print(request.LANGUAGE_CODE)
        return redirect('/app/de/')
    
    def render_angular_de(request):
        return render(request, "de/index.html")
    
    def render_angular_en(request):
        return render(request, "en/index.html")
    
    
    def _static_butler(request, path, **kwargs):
        """
        Serve static files using the django static files configuration
        WITHOUT collectstatic. This is slower, but very useful for API 
        only servers where the static files are really just for /admin
    
        Passing insecure=True allows serve_static to process, and ignores
        the DEBUG=False setting
        """
        return serve_static(request, path, insecure=True, **kwargs)
    
    urlpatterns = [
        path("admin/", admin.site.urls),
        path("api/v1/consents/", include("consents.urls")),
        path("api/v1/auth/", include("users.urls")),
        path("api/v1/provider/", include("providers.urls")),
        path("api/v1/data-disclosure/", include("data_disclosure.urls")),
        path("api/v1/data-removal/", include("data_removal.urls")),
        path("xapi/", include("xapi.urls")),
        path("login-success/", views.LogInSuccessView.as_view(), name="login-success"),
        re_path(r"^(?:.*/)?login/?$", views.LogInView.as_view(), name="sso-login"),  # aggressive login pattern helps against apps that provide own login pages and forms
        re_path(r"^logout/?$", views.LogOutView.as_view(), name="sso-logout"),
        re_path(r"^logout/message/?$", views.LoggedOutLocallyView.as_view(), name="sso-logged-out-locally"),
        re_path(r"^logout/idp/?$", views.IdpLogoutRedirectView.as_view(), name="sso-logout-idp"),
        re_path(r"^saml2/acs/?$", views.ACSAuthNView.as_view(), name="sso-saml2-acs"),
        re_path(r"^saml2/sls/?$", views.SLSView.as_view(), name="sso-saml2-sls"),
        re_path(r"^saml2/meta(?:data)?/?$", views.MetadataView.as_view(), name="sso-saml2-meta"),
        re_path(r"^sso-dev/?$", views.DevView.as_view(), name="sso-dev"),
    
        path("app/de/", render_angular_de),
        path("app/en/", render_angular_en),
        re_path(r'^app/de/(?P<path>.*)$', serve,{'document_root': os.path.join(settings.BASE_DIR,  "frontend/dist/frontend/de")}),
        re_path(r"^$", detect_lang_redirect),
        re_path(r"^(?:.*)/?$", detect_lang_redirect),
    ]
    
    if settings.DEBUG == "True":
        urlpatterns.append(
            re_path(
                r"^redoc/$",
                schema_view.with_ui("redoc", cache_timeout=0),
                name="schema-redoc",
            ),
        )
        #urlpatterns.append(
            #re_path(r"^sso-dev/?$", views.DevView.as_view(), name="sso-dev"),
        #)