Skip to content

Instantly share code, notes, and snippets.

View koliber's full-sized avatar

Krystian Cybulski koliber

View GitHub Profile
@koliber
koliber / serializers.py
Created September 8, 2015 14:28
`ExtensibleModelSerializer` prototype for rest_framework
class ExtensibleModelSerializer(serializers.ModelSerializer):
"""
Allows for specifying ``non_native_fields`` in the Meta, which allow for custom handling
of some fields, while letting the ``ModelSerializer`` do its magic with the rest of the fields.
For any fields which are not read from or set directly on the model using ``ModelSerializer``'s
logic, you need to provide a mechanism for:
* getting the value from the model
* changing the incoming data to an internal representation (for updates and creates)
@koliber
koliber / gist:65d882cb74c1f72a6cd0
Created May 8, 2015 20:22
SAML Sample Config - ADFS
<EntityDescriptor ID="_d13abd16-1d30-4fea-bd9a-ecfd62f76055" entityID="http://adfs.medienhaus.at/adfs/services/trust" xmlns="urn:oasis:names:tc:SAML:2.0:metadata">
<ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:SignedInfo>
<ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />
<ds:SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256" />
<ds:Reference URI="#_d13abd16-1d30-4fea-bd9a-ecfd62f76055">
<ds:Transforms>
<ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" />
<ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />
</ds:Transforms>
@koliber
koliber / gist:8dcaaea7fe90d1b9a7cf
Created May 8, 2015 20:21
SAML Sample Config - Azure
<EntityDescriptor ID="_9785a1c6-d7ef-429d-895c-74380d2b2f81" entityID="https://sts.windows.net/0ac53016-3006-4227-9eeb-89d63f8055b6/" xmlns="urn:oasis:names:tc:SAML:2.0:metadata">
<RoleDescriptor xsi:type="fed:SecurityTokenServiceType" xmlns:fed="http://docs.oasis-open.org/wsfed/federation/200706" protocolSupportEnumeration="http://docs.oasis-open.org/wsfed/federation/200706" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<KeyDescriptor use="signing">
<KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
<X509Data>
<X509Certificate>MIIDPjCCAiqgAwIBAgIQsRiM0jheFZhKk49YD0SK1TAJBgUrDgMCHQUAMC0xKzApBgNVBAMTImFjY291bnRzLmFjY2Vzc2NvbnRyb2wud2luZG93cy5uZXQwHhcNMTQwMTAxMDcwMDAwWhcNMTYwMTAxMDcwMDAwWjAtMSswKQYDVQQDEyJhY2NvdW50cy5hY2Nlc3Njb250cm9sLndpbmRvd3MubmV0MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAkSCWg6q9iYxvJE2NIhSyOiKvqoWCO2GFipgH0sTSAs5FalHQosk9ZNTztX0ywS/AHsBeQPqYygfYVJL6/EgzVuwRk5txr9e3n1uml94fLyq/AXbwo9yAduf4dCHTP8CWR1dnDR+Qnz/4PYlWVEuuHHO
@koliber
koliber / gist:54079e4802ae89ea51f6
Created May 8, 2015 20:20
SAML Sample Config - Okta
<md:EntityDescriptor xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata" entityID="http://www.okta.com/exk12m4qh9dOTpmZO0i8">
<md:IDPSSODescriptor WantAuthnRequestsSigned="true" protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol">
<md:KeyDescriptor use="signing">
<ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:X509Data>
<ds:X509Certificate>MIIDnjCCAoagAwIBAgIGAUtBzSYgMA0GCSqGSIb3DQEBBQUAMIGPMQswCQYDVQQGEwJVUzETMBEG
A1UECAwKQ2FsaWZvcm5pYTEWMBQGA1UEBwwNU2FuIEZyYW5jaXNjbzENMAsGA1UECgwET2t0YTEU
MBIGA1UECwwLU1NPUHJvdmlkZXIxEDAOBgNVBAMMB2h1YnNwb3QxHDAaBgkqhkiG9w0BCQEWDWlu
Zm9Ab2t0YS5jb20wHhcNMTUwMTMxMjEwMTE4WhcNNDUwMTMxMjEwMjE4WjCBjzELMAkGA1UEBhMC
VVMxEzARBgNVBAgMCkNhbGlmb3JuaWExFjAUBgNVBAcMDVNhbiBGcmFuY2lzY28xDTALBgNVBAoM
@koliber
koliber / gist:9274aec9ea98953224b5
Created May 8, 2015 20:17
SAML Metadata Sample 1 - OneLogin
<EntityDescriptor xmlns="urn:oasis:names:tc:SAML:2.0:metadata" entityID="https://app.onelogin.com/saml/metadata/402470">
<IDPSSODescriptor xmlns:ds="http://www.w3.org/2000/09/xmldsig#" protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol">
<KeyDescriptor use="signing">
<ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:X509Data>
<ds:X509Certificate>MIIBrTCCAaGgAwIBAgIBATADBgEAMGcxCzAJBgNVBAYTAlVTMRMwEQYDVQQIDApD
YWxpZm9ybmlhMRUwEwYDVQQHDAxTYW50YSBNb25pY2ExETAPBgNVBAoMCE9uZUxv
Z2luMRkwFwYDVQQDDBBhcHAub25lbG9naW4uY29tMB4XDTExMDgxNjIxMjIxMFoX
DTE2MDgxNTIxMjIxMFowZzELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlmb3Ju
aWExFTATBgNVBAcMDFNhbnRhIE1vbmljYTERMA8GA1UECgwIT25lTG9naW4xGTAX

Keybase proof

I hereby claim:

  • I am koliber on github.
  • I am krystian (https://keybase.io/krystian) on keybase.
  • I have a public key whose fingerprint is 63F7 A21B 8679 E8EA 4511 CDBF 4AE2 D903 4BDB 022E

To claim this, I am signing this object: