Skip to content

Instantly share code, notes, and snippets.

View skyforest's full-sized avatar

Cody Antunez skyforest

View GitHub Profile
<?php
$metadata['https://samltest.id/saml/sp'] = [
'entityid' => 'https://samltest.id/saml/sp',
'attributemap' => 'unified2name',
'contacts' => [],
'metadata-set' => 'saml20-sp-remote',
'AssertionConsumerService' => [
[
'Binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST',
'Location' => 'https://samltest.id/Shibboleth.sso/SAML2/POST',
@skyforest
skyforest / example_saml_auth_decorator.py
Created February 2, 2023 14:51
An example flask decorator that checks if the current users has 'saml_user' in session and redirects to the login flow if not.
from functools import wraps
from flask import request, redirect, url_for
# custom decorator
def check_auth(f):
@wraps(f)
def decorated(*args, **kwargs):
if 'saml_user' not in session:
return redirect(url_for('login'))
return func(*args, **kwargs)