Skip to content

Instantly share code, notes, and snippets.

@DDmitrid
DDmitrid / mongoDB.md
Created March 9, 2018 08:36 — forked from federico-garcia/mongoDB.md
MongoDB guide

Running mongodb

docker run -d -v $(pwd)/data/single:/data/db -v $(pwd)/config/single/mongod.conf:/etc/mongod.conf -p 27017:27017 --name mongo-server mongo:3.4 mongod -f /etc/mongod.conf

mongod - the server itself
mongo - mongodb cli (you can run js scripts)

default data directory: /data/db default DB: test default port: 27017 (config parameter net:port anf net:bindIp)

@DDmitrid
DDmitrid / redis.md
Created March 9, 2018 08:34 — forked from federico-garcia/redis.md
Redis

Redis

Redis stands for REmote DIctionary Server. By default, redis stores all data in memory. It's a key-structure database. redis-server is the actual datastore. redis-cli is the command line interface that performs any redis command. By default, redis binds to port 6379.

Starting the redis server

redis-server

While you can build a complete system using Redis only, I think most people will find that it supplements their more generic data solution - whether that be a traditional relational database, a document-oriented system, or something else. It’s the kind of solution you use to implement specific features.

@DDmitrid
DDmitrid / spring_session.sql
Created March 9, 2018 07:32 — forked from zoozalp/spring_session.sql
Create spring session tables
CREATE TABLE SPRING_SESSION (
SESSION_ID CHAR(36) NOT NULL,
CREATION_TIME BIGINT NOT NULL,
LAST_ACCESS_TIME BIGINT NOT NULL,
MAX_INACTIVE_INTERVAL INT NOT NULL,
PRINCIPAL_NAME VARCHAR(100),
CONSTRAINT SPRING_SESSION_PK PRIMARY KEY (SESSION_ID)
);
CREATE INDEX SPRING_SESSION_IX1 ON SPRING_SESSION (LAST_ACCESS_TIME);
@DDmitrid
DDmitrid / tokens.md
Created March 6, 2018 14:20 — forked from zmts/tokens.md
Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию

Token-Based Authentication(JWT)

Preconditions:

В данной заметке рассматривается работа JWT с симметичным алгоритмом шифрования (HS256/HS384/HS512)

Основы:

Аутентификация(authentication, от греч. αὐθεντικός [authentikos] – реальный, подлинный; от αὐθέντης [authentes] – автор) - это процесс проверки учётных данных пользователя (логин/пароль). Проверка подлинности пользователя путём сравнения введённого им логина/пароля с логином/паролем, сохранённым в базе данных пользователей.

Авторизация(authorization — разрешение, уполномочивание) - это проверка прав пользователя на доступ к определенным ресурсам.