Authentication

Authentication

Refs

Authentication Schemes

Basic

  • This is the simplest form of HTTP authentication, where the client sends the username and password in base64 encoded text as part of the HTTP header. The server then checks the username and password against a user database and sends a response indicating whether the authentication was successful or not. This scheme is not very secure, as the password is transmitted in clear text and can be intercepted by anyone who is listening on the network.

Bearer

  • A token-based scheme that is set in the Authorization header in the format Bearer <token>.
  • “Bearer” means the client is the bearing the token.
  • Bearer token mostly uses JWT.

Digest

  • This is a more secure form of HTTP authentication that uses a cryptographic hash to protect the password. When the client sends the username and password, the server sends a challenge that includes a nonce value. The client then computes a hash of the password and other information, including the nonce, and sends the hash back to the server. The server then checks the hash to authenticate the user.

OAuth2

  • See my OAuth2 blog.
Flarum

Flarum

Install

Apache

  • Server: Apache2.4 + PHP 7.4.33. Make sure they are installed and connected.

  • Database: Install Mysql5. Create a database for flarum, e.g. flarum.

  • Configure PHP:

    • Enable fileinfo, gd2 and pdo_mysql.
  • Install Composer, which a php package management tool like npm.

  • Install Flarum:

    • Create a folder named flarum, cd into it and run composer create-project flarum/flarum ..
    • If vendor packages failed to install due to network issues, install behind a proxy:
      • Turn on your proxy and run set HTTP_PROXY=http://127.0.0.1:7078
      • run composer install
  • Configure Apache:

1
2
3
4
5
6
7
8
DocumentRoot "D:\tmp\flarum\public"
<Directory "D:\tmp\flarum\public">
Options Indexes FollowSymLinks
AllowOverride All // It must be set to ALL otherwise error: the requested resource was not found
Require all granted
</Directory>

LoadModule rewrite_module modules/mod_rewrite.so
  • Configure Flarum:
    • in flarum installation folder, edit config.php:
      • 'url' => 'http://localhost' change to 'url' => 'http://[domain or ip]'
    • install chinese langauge pack:
      • composer require flarum-lang/chinese-simplified
      • php flarum cache:clear
Docker

Docker

Why Docker

  • Docker enables you to separate your applications from your infrastructure so you can deliver software quickly.

Concepts

  • Container

    • is a runnable instance of an image. You can create, start, stop, move, or delete a container using the DockerAPI or CLI.
    • can be run on local machines, virtual machines or deployed to the cloud.
    • is portable (can be run on any OS).
    • is isolated from other containers and runs its own software, binaries, and configurations.
  • Image

  • The image contains the container’s filesystem, it must contain everything needed to run an application

Dockerfile

  • A Dockerfile contains a script of instructions that Docker uses to create a container image.
ChatGPT
Wordpress
站群、Adsense、Media Buy
VPS

VPS

Concept

Ref

Read more
Wordpress Ecommerce website
Frontend Questions

Frontend Questions

  1. Why assigning too many ids to html elements is not a good practice?
Read more
CSS & HTML tips

CSS & HTML tips

CSS

Background

1
2
3
body {
background: #ffffff url("img_tree.png") no-repeat right top;
}
Read more