Skip to content

Instantly share code, notes, and snippets.

Avatar

Gert Drapers gertd

View GitHub Profile
@gertd
gertd / input-redacted-v2.json
Last active Oct 26, 2021
input-redacted-v2
View input-redacted-v2.json
{
"identity": {
"redacted": "..."
},
"policy": {
"redacted": "..."
},
"user": {
"id": "dfdadc39-7335-404d-af66-c77cf13a15f8",
"display_name": "Euan Garden",
View input-redacted.js
{
"identity": {
"redacted": "..."
},
"policy": {
"redacted": "..."
},
"user": {
"applications": {
"peoplefinder": {
View input-full.json
{
"identity": {
"identity": "euang@acmecorp.com",
"type": "IDENTITY_TYPE_SUB"
},
"policy": {
"decisions": [
"allowed"
],
"id": "15e4ecf8-dfa0-11eb-98f2-018bdf252971",
View is-allowed.json
{
"policyContext": {
"decisions": [
"allowed"
],
"id": "15e4ecf8-dfa0-11eb-98f2-018bdf252971",
"path": "peoplefinder.PUT.api.users.__id"
},
"identityContext": {
"identity": "euang@acmecorp.com",
@gertd
gertd / example.go
Created Sep 29, 2021
aserto-runtime-blog-example
View example.go
// Create a runtime
r, cleanup, err := runtime.NewRuntime(
ctx,
&logger,
&runtime.Config{},
)
if err != nil {
return errors.Wrap(err, "failed to create runtime")
}
defer cleanup()
@gertd
gertd / example-2.go
Created Sep 29, 2021
aserto-runtime-blog-example-2
View example-2.go
package main
import (
"context"
"fmt"
"os"
"time"
"github.com/aserto-dev/runtime"
"github.com/open-policy-agent/opa/ast"
@gertd
gertd / example-1.go
Created Sep 29, 2021
aserto-runtime-blog-example-1
View example-1.go
package main
import (
"context"
"os"
"github.com/aserto-dev/runtime"
"github.com/rs/zerolog"
)
@gertd
gertd / auth.go
Created Sep 3, 2020 — forked from ogazitt/auth.go
Auth0 PKCE flow for a CLI built in golang
View auth.go
package auth
import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"net"
"net/http"
"net/url"
@gertd
gertd / dump.txt
Created Apr 9, 2020
gh http.REST("DELETE", ...) 204-nocontent
View dump.txt
// resp
(*http.Response)(0xc0000d0000)({
Status: (string) (len=14) "204 No Content",
StatusCode: (int) 204,
Proto: (string) (len=8) "HTTP/1.1",
ProtoMajor: (int) 1,
ProtoMinor: (int) 1,
Header: (http.Header) (len=17) {
(string) (len=25) "Strict-Transport-Security": ([]string) (len=1 cap=1) {
@gertd
gertd / git-pull
Last active Aug 9, 2019
git-pull - pull all repos in current directory helper script
View git-pull
#!/usr/bin/env bash
basedir=$PWD
for dir in $(find "$basedir" -mindepth 1 -maxdepth 4 -type d); do
[ -d "$dir/.git" ] && echo $dir && cd $dir && git pull && cd ..
done