Last major update: 25.08.2020
- Что такое авторизация/аутентификация
- Где хранить токены
- Как ставить куки ?
- Процесс логина
- Процесс рефреш токенов
- Кража токенов/Механизм контроля токенов
class TestDrive { | |
public static void main(String[] args) throws InterruptedException { | |
BurgerStore mcDonalds = new McDonStore(); | |
BurgerStore burgerKing = new BurgerKingStore(); | |
Burger burger; | |
System.out.println("-Hello, one McDonalds style cheeseburger"); | |
System.out.println("-Okay! Please wait for a sec, -Calling to the McDonaldsStore. -Cheeseburger"); | |
burger = mcDonalds.orderBurger(Burger.CHEESE); |
import java.io.BufferedReader; | |
import java.io.IOException; | |
import java.io.InputStreamReader; | |
import java.util.*; | |
import java.util.stream.Collectors; | |
import static java.util.function.Function.identity; | |
public class Main { | |
public static void main(String[] args) throws IOException { | |
BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); |
// Let's consider an example. UsdConverter class is responsible for converting local currency to USD (United States dollar). | |
// The test should check the behavior of the tested unit in isolation from its dependencies. | |
// As the exchange rate varies with time, UsdConverter uses ExchangeRateService to get the latest updates. | |
// Moreover, getUsd method of a live ExchangeRateService can send a request over HTTP to get the actual exchange rate, | |
// which is difficult to reproduce in the test environment. | |
// Mockito allows us to avoid those difficulties and provides an API for creating empty objects and managing behavior. | |
// Note: here we use BigDecimal since financial transactions need high accuracy: | |
public class UsdConverter { |
package com.javarush.task.task04.task0442; | |
import java.io.BufferedReader; | |
import java.io.InputStreamReader; | |
public class Solution { | |
public static void main(String[] args) throws Exception { | |
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); | |
int sum = 0; | |
int number = 0; |
connections { | |
rw { | |
pools = primary-pool | |
local { | |
auth = pubkey | |
certs = cert.pem | |
id = certificate_domain_name | |
} | |
remote { | |
auth = eap-mschapv2 |
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT | |
iptables -A INPUT -m state --state NEW -p tcp --dport 22 -j ACCEPT # SSH | |
iptables -A INPUT -p udp --dport 500 -j ACCEPT # for ISAKMP (handling of security associations) | |
iptables -A INPUT -p udp --dport 4500 -j ACCEPT # for NAT-T (handling of IPsec between natted devices) | |
iptables -A INPUT -p 50 -j ACCEPT # ESP - IP port 50 for ESP payload (the encrypted data packets) | |
iptables -A INPUT -j DROP | |
# Protect from trafic routing outside (WAN). Use outer interface here if any | |
iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT | |
#iptables -A FORWARD -j REJECT |
package org.example; | |
import com.fasterxml.jackson.annotation.JsonProperty; | |
import com.fasterxml.jackson.databind.ObjectMapper; | |
import java.io.File; | |
import java.io.IOException; | |
import java.util.ArrayList; | |
import java.util.Objects; |
{ | |
"questions": [ | |
"Question1", | |
"Question2" | |
], | |
"answers": [ | |
{ | |
"options": [ | |
"Variant1", | |
"Variant2" |
cd ~/hugoblog; git add --all; git commit -m "next commit"; git push; ssh me "cd /web/yabbarov.ru/hugoblog; git pull; hugo" |