Skip to content

Commit 35d21ae

Browse files
committed
login page (backend)
1 parent d46cd94 commit 35d21ae

25 files changed

+3507
-85
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@ Bob Management GUI changelog
55
## [Unreleased]
66

77
#### Added
8+
89
- Initial project structure, backend only (#9)
910
- Initial project stricture, frontend (#10)
1011
- Dockerfile and Docker-Compose to simplify deployment (#5)
1112
- CI/CD configuration (#11)
1213
- Logger Initialization (#14)
14+
- Login Page, backend (#16)

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ license-file = "./LICENSE"
77
edition = "2021"
88

99
[workspace]
10-
members = [ "cli", "frontend", "backend", "utils" ]
10+
members = [ "cli", "frontend", "backend", "utils", "proc_macro" ]
1111
default-members = [ "frontend", "backend"]
1212
resolver = "2"
1313

api/openapi.yaml

Lines changed: 98 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,117 @@
11
openapi: 3.0.3
22
info:
33
title: bob-management
4-
description: 'Bob Management GUI: Backend'
4+
description: Bob Management GUI
55
contact:
66
name: Romanov Simeon [email protected]
77
license:
88
name: ''
99
version: 0.0.0
1010
paths:
11-
/root:
11+
/api/v1/login:
12+
post:
13+
tags:
14+
- services::auth
15+
summary: Login to a BOB cluster
16+
description: |
17+
Login to a BOB cluster
18+
19+
# Errors
20+
This function can return the following errors
21+
22+
1. [`StatusCode::BAD_REQUEST`]
23+
The function failed to parse hostname of the request
24+
25+
2. [`StatusCode::NOT_FOUND`]
26+
The client was unable to reach the host
27+
28+
3. [`StatusCode::UNAUTHORIZED`]
29+
The client couldn't authorize on the host
30+
operationId: login
31+
parameters:
32+
- name: hostname
33+
in: path
34+
description: Address to connect to
35+
required: true
36+
schema:
37+
$ref: '#/components/schemas/Hostname'
38+
- name: credentials
39+
in: path
40+
description: '[Optional] Credentials used for BOB authentication'
41+
required: true
42+
schema:
43+
allOf:
44+
- $ref: '#/components/schemas/Credentials'
45+
nullable: true
46+
requestBody:
47+
description: ''
48+
content:
49+
application/json:
50+
schema:
51+
$ref: '#/components/schemas/BobConnectionData'
52+
required: true
53+
responses:
54+
'200':
55+
description: Successful authorization
56+
'400':
57+
description: Bad Hostname
58+
'401':
59+
description: Bad Credentials
60+
'404':
61+
description: Can't reach specified hostname
62+
/api/v1/logout:
63+
post:
64+
tags:
65+
- services::auth
66+
operationId: logout
67+
responses:
68+
'200':
69+
description: Logged out
70+
/api/v1/root:
1271
get:
1372
tags:
1473
- crate
1574
operationId: root
1675
responses:
1776
'200':
1877
description: Hello Bob!
78+
components:
79+
schemas:
80+
BobConnectionData:
81+
type: object
82+
description: Data needed to connect to a BOB cluster
83+
required:
84+
- hostname
85+
properties:
86+
credentials:
87+
allOf:
88+
- $ref: '#/components/schemas/Credentials'
89+
nullable: true
90+
hostname:
91+
$ref: '#/components/schemas/Hostname'
92+
example:
93+
credentials:
94+
login: archeoss
95+
password: '12345'
96+
hostname: 0.0.0.0:7000
97+
Credentials:
98+
type: object
99+
description: Optional auth credentials for a BOB cluster
100+
required:
101+
- login
102+
- password
103+
properties:
104+
login:
105+
type: string
106+
description: Login used during auth
107+
password:
108+
type: string
109+
description: Password used during auth
110+
example:
111+
login: archeoss
112+
password: '12345'
113+
Hostname:
114+
$ref: '#/components/schemas/Uri'
19115
tags:
20116
- name: bob
21117
description: BOB management API

backend/Cargo.toml

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "bob-management"
3-
description = "Bob Management GUI: Backend"
3+
description = "Bob Management GUI"
44
publish = false
55
keywords = [ "BOB", "Management", "GUI" ]
66
version.workspace = true
@@ -13,10 +13,9 @@ repository.workspace = true
1313
[dependencies]
1414
# Backend (lib.rs)
1515
## Axum related
16-
axum = "0.6"
16+
axum = { version = "0.6", features = ["headers"] }
1717
axum-macros = "0.3"
18-
axum-login = "0.6"
19-
axum-sessions = "0.6"
18+
tower-sessions = "0.5"
2019
tower = "0.4"
2120
tower-http = { version = "0.4", features = ["cors", "fs"] }
2221

@@ -25,15 +24,20 @@ tracing = "0.1"
2524
file-rotate = "0.7"
2625
tracing-appender = "0.2"
2726
tracing-subscriber = "0.3"
27+
# tracing-forest = { version = "0.1", features = ["tokio"] }
2828

2929
## Error Handling
3030
error-stack = "0.4"
3131
thiserror = "1.0"
3232

3333
## General
3434
tokio = { version = "1.32", features = ["rt", "macros", "rt-multi-thread" ] }
35-
hyper = "0.14"
36-
lazy_static = "1.4"
35+
hyper = { version = "0.14", features = ["http2", "client"] }
36+
hyper_serde = "0.13"
37+
serde = { version = "1.0", features = ["derive"] }
38+
serde_json = "1.0"
39+
uuid = { version = "1.4", features = ["v4", "serde", "fast-rng"] }
40+
futures = "0.3"
3741

3842
## OpenAPI + Swagger
3943
utoipa = { version = "4.0", features = ["yaml", "axum_extras", "chrono", "openapi_extensions"], optional = true }
@@ -44,7 +48,14 @@ utoipa-rapidoc = { version = "1.0", features = ["axum"], optional = true }
4448
## CLI
4549
cli = { path = "../cli" }
4650

51+
# Macro
52+
proc-macro = { path = "../proc_macro" }
53+
54+
[dev-dependencies]
55+
utoipa = { version = "4.0", features = ["yaml", "axum_extras", "chrono", "openapi_extensions"]}
56+
4757
[features]
4858
default = [ "swagger" ]
4959
swagger = [ "dep:utoipa", "dep:utoipa-swagger-ui" , "dep:utoipa-redoc", "dep:utoipa-rapidoc" ]
5060
gen_api = [ "dep:utoipa" ]
61+

0 commit comments

Comments
 (0)