Skip to content

Instantly share code, notes, and snippets.

<saml:Attribute
Name="email"
NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic">
<saml:AttributeValue xsi:type="xs:string">
dev.null.dump.1@gmail.com
</saml:AttributeValue>
</saml:Attribute>
<samlp:AuthnRequest xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"
ID="_423459839113526641" IssueInstant="2021-07-19T20:09:18+08:00"
ProtocolBinding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect"
Version="2.0">
<saml:Issuer xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion">
http://sp.samltools.com
</saml:Issuer>
</samlp:AuthnRequest>
XML Element/Attribute Explanation
samlp:AuthnRequest Standard element to represent a SAML AuthnRequest
ID Unique value representing the ID of the request. When IDP responds, the assertion will have an attribute inResponseTo with the same value as this ID
Protocol-Binding Represents how the HTTP request for AuthnRequest is sent. The sample uses "Redirect" binding which means the payload is sent as query par
func readBookDatasetOptimized(protoInFile string) error {
var rLen uint32
var book typedefs.Book
//Buffer to read bytes for decoding
var buf bytes.Buffer
done := false
//Fixed Length Buffer for reading from the file
rbuf := make([]byte, 1024)
r, err := os.Open(protoInFile)
if err != nil {
func readBookDataset(protoInFile string) error {
var rLen uint32
var book typedefs.Book
r, err := os.Open(protoInFile)
if err != nil {
return err
}
defer r.Close()
func serializeBookDataset(protoOutFile string) error {
w, err := os.OpenFile(protoOutFile, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0644)
if err != nil {
return err
}
defer w.Close()
csvFile, err := os.Open("books.csv")
if err != nil {
return err
func readOps(outfile string) error {
in, err := ioutil.ReadFile(outfile)
if err != nil {
return err
}
instructions := &typedefs.Instructions{}
if err := proto.Unmarshal(in, instructions); err != nil {
return err
}
for _, patch := range instructions.Operations {
syntax='proto3';
package typedefs;
option go_package ='./typedefs';
message Patch{
message Copy{
int64 start =1;
int64 end=2;
}
message Insert{
func writeOps(outfile string) error {
f, err := os.OpenFile(outfile, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0644)
if err != nil {
log.Fatalf("Failed to create file %s", err.Error())
}
defer f.Close()
op1 := &typedefs.Patch_Copy{Start: 10, End: 100}
op2 := &typedefs.Patch_Insert{RawBytes: []byte{'a', 'b', 'c', 'd', 'e', 'a', 'b', 'c', 'd', 'e'}}
ops := []*typedefs.Patch{
@monmohan
monmohan / context_propagation.go
Created July 12, 2020 09:56
Context propagation from client to server
unc runTestServer() string {
slowServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
incoming, _ := httputil.DumpRequest(r, false)
fmt.Printf("Server: Incoming Request %s", string(incoming))
ctx := r.Context()
echan := make(chan error)
go func() {
time.Sleep(12 * time.Second) // Do difficult Job
_, err := w.Write([]byte("Hello There!"))
echan <- err