|
|
@@ -14,6 +14,8 @@
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
# See the License for the specific language governing permissions and
|
|
|
# limitations under the License.
|
|
|
+from django.urls import reverse
|
|
|
+from django.utils.html import escape
|
|
|
from djangosaml2.views import AssertionConsumerServiceView, EchoAttributesView, LoginView, LogoutView, MetadataView
|
|
|
|
|
|
from desktop.lib.django_util import render
|
|
|
@@ -38,11 +40,8 @@ def local_logout(request, next_page=None):
|
|
|
Local logout: clears Django session only, not the SAML session.
|
|
|
Then presents a button to redirect to SAML login.
|
|
|
"""
|
|
|
- import libsaml.conf
|
|
|
- base_url = libsaml.conf.BASE_URL.get()
|
|
|
- logout_url = libsaml.conf.CDP_LOGOUT_URL.get()
|
|
|
- authenticate_url = logout_url.replace("logout", "authenticate")
|
|
|
- login_url = f"{authenticate_url}?loginRedirect={base_url}"
|
|
|
+ next_path = request.GET.get("next", "/")
|
|
|
+ login_url = f"{reverse('saml2_login')}?next={escape(next_path)}"
|
|
|
|
|
|
return render('logged_out.mako', request, {
|
|
|
'login_url': login_url,
|