Skip to content

Commit

Permalink
Add admin login system
Browse files Browse the repository at this point in the history
  • Loading branch information
MasterPtato committed Nov 15, 2023
1 parent b9a2360 commit 0b97dc2
Show file tree
Hide file tree
Showing 69 changed files with 1,517 additions and 254 deletions.
23 changes: 23 additions & 0 deletions fern/definition/admin/__package__.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/fern-api/fern/main/fern.schema.json

service:
auth: true
base-path: /admin
audiences:
- public
endpoints:
login:
path: /login
method: POST
request:
body: LoginRequest
response: LoginResponse

types:
LoginRequest:
properties:
name: string

LoginResponse:
properties:
url: string
3 changes: 0 additions & 3 deletions fern/definition/admin/groups.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/fern-api/fern/main/fern.schema.json

imports:
gameCommons: ../game/common.yml

service:
auth: true
base-path: /admin/groups
Expand Down
22 changes: 22 additions & 0 deletions fern/definition/auth/identity/accessToken.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/fern-api/fern/main/fern.schema.json

imports:
commons: ../../common.yml
localCommons: ../common.yml
captchaConfig: ../../captcha/config.yml

service:
auth: true
base-path: /auth/identity/access-token
endpoints:
completeAccessTokenVerification:
path: /complete-verification
method: POST
docs: Completes the access token verification process.
request:
body: CompleteAccessTokenVerificationRequest

types:
CompleteAccessTokenVerificationRequest:
properties:
access_token: commons.JWT
Original file line number Diff line number Diff line change
@@ -1,21 +1,13 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/fern-api/fern/main/fern.schema.json

imports:
localCommons: common.yml
captchaConfig: ../captcha/config.yml
localCommons: ../common.yml
captchaConfig: ../../captcha/config.yml

service:
auth: true
base-path: /auth/identity/email
endpoints:
completeEmailVerification:
path: /complete-verification
method: POST
docs: Completes the email verification process.
request:
body: CompleteEmailVerificationRequest
response: CompleteEmailVerificationResponse

startEmailVerification:
path: /start-verification
method: POST
Expand All @@ -24,19 +16,15 @@ service:
body: StartEmailVerificationRequest
response: StartEmailVerificationResponse

types:
CompleteEmailVerificationRequest:
properties:
verification_id:
type: uuid
code:
docs: The code sent to the requestee's email.
type: uuid

CompleteEmailVerificationResponse:
properties:
status: localCommons.CompleteStatus
completeEmailVerification:
path: /complete-verification
method: POST
docs: Completes the email verification process.
request:
body: CompleteEmailVerificationRequest
response: CompleteEmailVerificationResponse

types:
StartEmailVerificationRequest:
properties:
email: string
Expand All @@ -48,3 +36,15 @@ types:
properties:
verification_id:
type: uuid

CompleteEmailVerificationRequest:
properties:
verification_id:
type: uuid
code:
docs: The code sent to the requestee's email.
type: string

CompleteEmailVerificationResponse:
properties:
status: localCommons.CompleteStatus
7 changes: 7 additions & 0 deletions fern/definition/cloud/__package__.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,15 @@ service:
types:
BootstrapResponse:
properties:
cluster: BootstrapCluster
captcha: BootstrapCaptcha

BootstrapCluster:
docs: The type of cluster that the backend is currently running.
enum:
- value: enterprise
- value: oss

BootstrapCaptcha:
properties:
turnstile: optional<BootstrapCaptchaTurnstile>
Expand Down
6 changes: 6 additions & 0 deletions fern/definition/identity/common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -204,12 +204,18 @@ types:
docs: A union representing an identity's linked accounts.
properties:
email: optional<EmailLinkedAccount>
access_token: optional<AccessTokenLinkedAccount>

EmailLinkedAccount:
docs: An identity's linked email.
properties:
email: commons.Email

AccessTokenLinkedAccount:
docs: An identity's access token identity.
properties:
name: string

DevState:
docs: The state of the given identity's developer status.
enum:
Expand Down
93 changes: 91 additions & 2 deletions gen/openapi/external/spec/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,63 @@ info:
title: Rivet API
version: ''
paths:
/admin/login:
post:
operationId: admin_login
tags:
- Admin
parameters: []
responses:
'200':
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/AdminLoginResponse'
'400':
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorBody'
'403':
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorBody'
'404':
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorBody'
'408':
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorBody'
'429':
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorBody'
'500':
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorBody'
security: &ref_0
- BearerAuth: []
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/AdminLoginRequest'
/cloud/bootstrap:
get:
description: Returns the basic information required to use the cloud APIs.
Expand Down Expand Up @@ -53,8 +110,7 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/ErrorBody'
security: &ref_0
- BearerAuth: []
security: *ref_0
/cloud/games/{game_id}/namespaces:
post:
description: Creates a new namespace for the given game.
Expand Down Expand Up @@ -7482,13 +7538,36 @@ paths:
security: *ref_0
components:
schemas:
AdminLoginRequest:
type: object
properties:
name:
type: string
required:
- name
AdminLoginResponse:
type: object
properties:
url:
type: string
required:
- url
CloudBootstrapResponse:
type: object
properties:
cluster:
$ref: '#/components/schemas/CloudBootstrapCluster'
captcha:
$ref: '#/components/schemas/CloudBootstrapCaptcha'
required:
- cluster
- captcha
CloudBootstrapCluster:
type: string
enum:
- enterprise
- oss
description: The type of cluster that the backend is currently running.
CloudBootstrapCaptcha:
type: object
properties:
Expand Down Expand Up @@ -10852,6 +10931,8 @@ components:
properties:
email:
$ref: '#/components/schemas/IdentityEmailLinkedAccount'
access_token:
$ref: '#/components/schemas/IdentityAccessTokenLinkedAccount'
IdentityEmailLinkedAccount:
type: object
description: An identity's linked email.
Expand All @@ -10860,6 +10941,14 @@ components:
$ref: '#/components/schemas/Email'
required:
- email
IdentityAccessTokenLinkedAccount:
type: object
description: An identity's access token identity.
properties:
name:
type: string
required:
- name
IdentityDevState:
type: string
enum:
Expand Down
34 changes: 24 additions & 10 deletions gen/openapi/internal/rust/.openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,20 @@
.travis.yml
Cargo.toml
README.md
docs/AdminApi.md
docs/AdminGroupsApi.md
docs/AuthCompleteEmailVerificationRequest.md
docs/AuthCompleteEmailVerificationResponse.md
docs/AdminLoginRequest.md
docs/AdminLoginResponse.md
docs/AuthCompleteStatus.md
docs/AuthIdentityApi.md
docs/AuthIdentityAccessTokenApi.md
docs/AuthIdentityCompleteAccessTokenVerificationRequest.md
docs/AuthIdentityCompleteEmailVerificationRequest.md
docs/AuthIdentityCompleteEmailVerificationResponse.md
docs/AuthIdentityEmailApi.md
docs/AuthIdentityStartEmailVerificationRequest.md
docs/AuthIdentityStartEmailVerificationResponse.md
docs/AuthRefreshIdentityTokenRequest.md
docs/AuthRefreshIdentityTokenResponse.md
docs/AuthStartEmailVerificationRequest.md
docs/AuthStartEmailVerificationResponse.md
docs/AuthTokensApi.md
docs/CaptchaConfig.md
docs/CaptchaConfigHcaptcha.md
Expand All @@ -23,6 +28,7 @@ docs/CloudAuthAgentIdentity.md
docs/CloudAuthApi.md
docs/CloudBootstrapCaptcha.md
docs/CloudBootstrapCaptchaTurnstile.md
docs/CloudBootstrapCluster.md
docs/CloudBootstrapResponse.md
docs/CloudBuildSummary.md
docs/CloudCdnAuthType.md
Expand Down Expand Up @@ -227,6 +233,7 @@ docs/GroupTransferOwnershipRequest.md
docs/GroupUpdateProfileRequest.md
docs/GroupValidateProfileRequest.md
docs/GroupValidateProfileResponse.md
docs/IdentityAccessTokenLinkedAccount.md
docs/IdentityActivitiesApi.md
docs/IdentityApi.md
docs/IdentityCancelGameLinkRequest.md
Expand Down Expand Up @@ -324,8 +331,10 @@ docs/UploadPresignedRequest.md
docs/ValidationError.md
docs/WatchResponse.md
git_push.sh
src/apis/admin_api.rs
src/apis/admin_groups_api.rs
src/apis/auth_identity_api.rs
src/apis/auth_identity_access_token_api.rs
src/apis/auth_identity_email_api.rs
src/apis/auth_tokens_api.rs
src/apis/cloud_api.rs
src/apis/cloud_auth_api.rs
Expand Down Expand Up @@ -362,13 +371,16 @@ src/apis/module_api.rs
src/apis/portal_games_api.rs
src/apis/portal_notifications_api.rs
src/lib.rs
src/models/auth_complete_email_verification_request.rs
src/models/auth_complete_email_verification_response.rs
src/models/admin_login_request.rs
src/models/admin_login_response.rs
src/models/auth_complete_status.rs
src/models/auth_identity_complete_access_token_verification_request.rs
src/models/auth_identity_complete_email_verification_request.rs
src/models/auth_identity_complete_email_verification_response.rs
src/models/auth_identity_start_email_verification_request.rs
src/models/auth_identity_start_email_verification_response.rs
src/models/auth_refresh_identity_token_request.rs
src/models/auth_refresh_identity_token_response.rs
src/models/auth_start_email_verification_request.rs
src/models/auth_start_email_verification_response.rs
src/models/captcha_config.rs
src/models/captcha_config_hcaptcha.rs
src/models/captcha_config_turnstile.rs
Expand All @@ -377,6 +389,7 @@ src/models/cloud_auth_agent_game_cloud.rs
src/models/cloud_auth_agent_identity.rs
src/models/cloud_bootstrap_captcha.rs
src/models/cloud_bootstrap_captcha_turnstile.rs
src/models/cloud_bootstrap_cluster.rs
src/models/cloud_bootstrap_response.rs
src/models/cloud_build_summary.rs
src/models/cloud_cdn_auth_type.rs
Expand Down Expand Up @@ -563,6 +576,7 @@ src/models/group_transfer_ownership_request.rs
src/models/group_update_profile_request.rs
src/models/group_validate_profile_request.rs
src/models/group_validate_profile_response.rs
src/models/identity_access_token_linked_account.rs
src/models/identity_cancel_game_link_request.rs
src/models/identity_complete_game_link_request.rs
src/models/identity_dev_state.rs
Expand Down
Loading

0 comments on commit 0b97dc2

Please sign in to comment.