Last major update: 25.08.2020
- Что такое авторизация/аутентификация
- Где хранить токены
- Как ставить куки ?
- Процесс логина
- Процесс рефреш токенов
- Кража токенов/Механизм контроля токенов
package main | |
import ( | |
"context" | |
"flag" | |
"fmt" | |
"io" | |
"net" | |
"net/http" | |
"os" |
// | |
// createCertificateAuthority generates a certificate authority request ready to be signed | |
// | |
func (r *secretStore) createCertificateAuthority(names pkix.Name, expiration time.Duration, size int) (*caCertificate, error) { | |
// step: generate a keypair | |
keys, err := rsa.GenerateKey(rand.Reader, size) | |
if err != nil { | |
return nil, fmt.Errorf("unable to genarate private keys, error: %s", err) | |
} |
# Make sure you grab the latest version | |
curl -OL https://github.com/google/protobuf/releases/download/v3.2.0/protoc-3.2.0-linux-x86_64.zip | |
# Unzip | |
unzip protoc-3.2.0-linux-x86_64.zip -d protoc3 | |
# Move protoc to /usr/local/bin/ | |
sudo mv protoc3/bin/* /usr/local/bin/ | |
# Move protoc3/include to /usr/local/include/ |
UNLOGGED
table. This reduces the amount of data written to persistent storage by up to 2x.WITH (autovacuum_enabled=false)
on the table. This saves CPU time and IO bandwidth
on useless vacuuming of the table (since we never DELETE
or UPDATE
the table).COPY FROM STDIN
. This is the fastest possible approach to insert rows into table.time timestamp with time zone
is enough.synchronous_commit = off
to postgresql.conf
.package main | |
import ( | |
"encoding/json" | |
"fmt" | |
"log" | |
) | |
type ( | |
AStruct struct { |
/* | |
An array shuffler with good randomness | |
*/ | |
package main | |
import ( | |
"fmt" | |
"math/big" | |
"crypto/rand" | |
) |
// A quick and dirty demo of talking HTTP over Unix domain sockets | |
package main | |
import ( | |
"fmt" | |
"io" | |
"net" | |
"net/http" | |
"os" |
Using MongoDB in golang with mgo |
# -*- coding: utf-8 -*- | |
def transliterate(string): | |
capital_letters = {u'А': u'A', | |
u'Б': u'B', | |
u'В': u'V', | |
u'Г': u'G', | |
u'Д': u'D', | |
u'Е': u'E', |