Last major update: 25.08.2020
- Что такое авторизация/аутентификация
- Где хранить токены
- Как ставить куки ?
- Процесс логина
- Процесс рефреш токенов
- Кража токенов/Механизм контроля токенов
| import {createReducer} from '@ngrx/store'; | |
| import {on} from "@ngrx/store"; | |
| import produce, {Draft} from "immer"; | |
| export const initialUserState: IUserState = { | |
| knownUsers: [user1, user2], | |
| selectedUser: null, | |
| scenes: null | |
| }; |
| fooapp@srv:~$ cat app/env/PLAY_OPTS | |
| export DATABASE_URL="jdbc:postgresql://127.0.0.1/foobar" | |
| # We could wire a different configuration file here | |
| # or set up a different database on the fly | |
| export PLAY_OPTS="-DapplyEvolutions.default=true -DapplyDownEvolutions.default=true -Ddb.default.url="$DATABASE_URL" -Ddb.default.user=fooapp -Ddb.default.password=fooapppw -Ddb.default.driver=org.postgresql.Driver" |
| # NOTE This is probably no longer needed, now DRF does this | |
| # automatically if you have ATOMIC_REQUESTS enabled. | |
| # https://github.com/encode/django-rest-framework/pull/2887 | |
| from django.db import transaction | |
| class AtomicMixin(object): | |
| """ | |
| Ensures we rollback db transactions on exceptions. |
| #! /usr/bin/env python | |
| import redis | |
| import random | |
| import pylibmc | |
| import sys | |
| r = redis.Redis(host = 'localhost', port = 6389) | |
| mc = pylibmc.Client(['localhost:11222']) |
| #define SYNTHESIZE_SINGLETON_FOR_CLASS_WITH_CUSTOM_METHOD(className, methodName) \ | |
| \ | |
| + (className *) methodName \ | |
| { \ | |
| static className *shared ## className; \ | |
| static dispatch_once_t token; \ | |
| dispatch_once(&token, ^{ \ | |
| shared ## className = [[className alloc] init]; \ | |
| }); \ | |
| \ |
| // | |
| // AppleMediaKeyController.h | |
| // | |
| // Modified by Gaurav Khanna on 8/17/10. | |
| // SOURCE: http://github.com/sweetfm/SweetFM/blob/master/Source/HMediaKeys.h | |
| // | |
| // | |
| // 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, |