Skip to content

Instantly share code, notes, and snippets.

View TakahikoKawasaki's full-sized avatar

Takahiko Kawasaki TakahikoKawasaki

View GitHub Profile
@TakahikoKawasaki
TakahikoKawasaki / sinatra+thin+ssl.rb
Last active October 19, 2023 14:38
Sinatra + Thin + SSL
#!/usr/bin/env ruby
#
# This code snippet shows how to enable SSL in Sinatra+Thin.
#
require 'sinatra'
require 'thin'
class MyThinBackend < ::Thin::Backends::TcpServer
def initialize(host, port, options)
@TakahikoKawasaki
TakahikoKawasaki / index.js
Created March 1, 2016 20:29
An example of "Amazon API Gateway Custom Authorizer" (node.js).
// An example of "Amazon API Gateway Custom Authorizer" (node.js).
// Copyright (c) 2016 Authlete, Inc.
//
// The MIT License
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without
// restriction, including without limitation the rights to use,
{
"iss": "https://authlete.com",
"sub": "1004",
"aud": [
"7681191256"
],
"exp": 1651654999,
"iat": 1651568599,
"auth_time": 1651568599,
"nonce": "n-0S6_WzA2Mj",
{
"id_token": {
"verified_claims": {
"verification":{
"trust_framework": null,
"assurance_process": {
"assurance_details": [
{
"assurance_type": {
"value": "verification"
{
"transformed_claims_predefined": {
"age_100_or_over": {
"claim": "birthdate",
"fn": [
"years_ago",
[ "gte", 100 ]
]
}
}
{
"id_token": {
"verified_claims": {
"verification": {
"trust_framework": null
},
"claims": {
"given_name": null,
"::age_100_or_over": null
}
{
"transformed_claims": {
"age_18_or_over": {
"claim": "birthdate",
"fn": [
"years_ago",
[ "gte", 18 ]
]
}
},
{
"age_18_or_over": {
"claim": "birthdate",
"fn": [
"years_ago",
[ "gte", 18 ]
]
}
}
{
"verified_claims": {
"verification": {
"trust_framework":"eidas",
"assurance_level": "substantial",
"evidence": [
{
"type": "document",
"method": "pipp",
"time": "2012-04-22T11:30Z",
{
"verified_claims": {
"verification": {
"trust_framework":"eidas",
"assurance_level": "substantial",
"evidence": [
{
"type": "document",
"method": "pipp",
"time": "2012-04-22T11:30Z",