sipd-auth/docs/swagger.yaml
2025-09-16 08:32:11 +07:00

954 lines
24 KiB
YAML

definitions:
form.ChangePasswordForm:
properties:
new_password:
description: New password
example: "123456"
type: string
new_password_repeat:
description: New password confirmation, must equal to password
example: "123456"
type: string
old_password:
description: Old password
example: "123456"
type: string
required:
- new_password
- new_password_repeat
- old_password
type: object
form.ChangePasswordFormPublik:
properties:
new_password:
description: New password
example: "123456"
type: string
new_password_repeat:
description: New password confirmation, must equal to password
example: "123456"
type: string
old_password:
description: Old password
example: "123456"
type: string
username:
description: |-
IdDaerah int64 `json:"id_daerah" xml:"id_daerah" form:"id_daerah" example:"101" validate:"gte=0"` //Id daerah target user
IdUser int64 `json:"id_user" xml:"id_user" form:"id_user" example:"18" validate:"gte=0"` //Id target user
example: user
type: string
required:
- new_password
- new_password_repeat
- old_password
- username
type: object
form.GenerateHashForm:
properties:
password:
example: "123456"
type: string
password_repeat:
example: "123456"
type: string
required:
- password
- password_repeat
type: object
form.LoginForm:
properties:
id_daerah:
description: Id daerah user
example: 34
type: integer
id_pegawai:
example: 36107
type: integer
password:
description: User password
example: "1"
type: string
required:
- password
type: object
form.PreLoginForm:
properties:
captcha_id:
type: string
captcha_solution:
type: string
password:
description: User password
example: "1"
type: string
tahun:
example: 2023
minimum: 1
type: integer
username:
description: Username of user (NIP)
example: "198604292011011004"
type: string
required:
- captcha_id
- captcha_solution
- password
- username
type: object
form.RefreshTokenForm:
properties:
token:
description: JWT expired token
example: xxxxx
type: string
required:
- token
type: object
form.SignupForm:
properties:
id_daerah:
description: ID Daerah
example: 251
type: integer
nama_bidang:
description: Nama Bidang
type: string
nama_user:
description: 'Nama User (Ex: Kab Tanggamus)'
example: Kab. Tanggamus
type: string
nip:
description: NIP
example: "123456789876543213"
type: string
password:
description: Password user
example: "123456"
type: string
password_repeat:
description: Confirm Password user
example: "123456"
type: string
username:
description: Username user
example: admlambar
type: string
required:
- id_daerah
- password
- password_repeat
- username
type: object
form.UpdateUserProfileForm:
properties:
alamat:
description: Alamat
example: xxxx
type: string
id_pang_gol:
description: ID pangkat/golongan
example: 1
type: integer
nama_user:
description: 'Nama User (Ex: Kab Tanggamus)'
example: Kab. Tanggamus
type: string
nik:
description: NIK
example: "123456789876543213"
type: string
npwp:
description: NPWP
example: "123456789876543213"
type: string
tgl_lahir:
description: Tanggal lahir
example: "1945-08-17"
type: string
required:
- id_pang_gol
- nama_user
- nik
- npwp
type: object
http_util.JSONResultLogin:
properties:
is_default_password:
example: false
type: boolean
refresh_token:
example: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2MzYxNjgyMjksImlk._aYI7pV2c9SU9VOp3RY_mxtFenYFQuKPJtVfk
type: string
token:
example: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2MzYwODU0MjksImlkIjoyLCJwaG9uZSI6Iis2MjgxMjM0NTYyIiwidXNlcm5hbWUiOi.dl_ojy9ojLnWqpW589YltLPV61TCsON-3yQ2
type: string
type: object
models.PreLoginModel:
properties:
id_daerah:
type: integer
id_pegawai:
type: integer
id_role:
type: integer
id_skpd_lama:
type: integer
id_unik_skpd:
type: string
id_user:
type: integer
kode_skpd:
type: string
nama_daerah:
example: Kota Bandar Lampung
type: string
nama_role:
type: string
nama_skpd:
type: string
nama_user:
example: John Doe
type: string
nip_user:
example: "196408081992011001"
type: string
type: object
models.ResponseLogin:
properties:
refresh_token:
description: Jwt refresh token
example: sdfsfsfsdfsfsdfsfsdfsf
type: string
token:
description: Jwt token
example: sdfsfsfsdfsfsdfsfsdfsf
type: string
type: object
models.UserDetail:
properties:
alamat:
example: sddsfsd
type: string
id_daerah:
example: 111
type: integer
id_role:
type: integer
id_skpd_lama:
type: integer
id_unik_skpd:
type: string
id_user:
example: 581
type: integer
kode_skpd:
type: string
nama_daerah:
example: Kota Bandar Lampung
type: string
nama_skpd:
type: string
nama_user:
example: John Doe
type: string
nik_user:
example: "222112323324"
type: string
nip_user:
example: "196408081992011001"
type: string
npwp_user:
example: "222112323324"
type: string
status:
type: string
type: object
models.ValidateCaptcha:
properties:
id:
type: string
solution:
type: string
required:
- id
- solution
type: object
utils.DataValidationError:
properties:
field:
example: email
type: string
message:
example: Invalid email address
type: string
type: object
utils.LoginError:
properties:
attempt:
description: sisa kesempatan login sebelum diblokir 5 menit
example: 3
type: integer
message:
description: keterangan error
example: invalid username or password
type: string
next_login:
description: unix timestamp UTC blokir login dibuka kembali
example: 123233213
type: integer
type: object
utils.RequestError:
properties:
code:
example: 422
type: integer
fields:
items:
$ref: '#/definitions/utils.DataValidationError'
type: array
message:
example: Invalid email address
type: string
type: object
info:
contact:
email: lifelinejar@mail.com
name: API Support
description: SIPD Service Auth Rest API.
license:
name: Apache 2.0
url: http://www.apache.org/licenses/LICENSE-2.0.html
termsOfService: http://swagger.io/terms/
title: SIPD Service Auth
version: "1.0"
paths:
/auth/amankan-kata-sandi:
post:
description: User melakukan Amankan Kata Sandi.
operationId: auth-amankan-kata-sandi
parameters:
- description: Payload
in: body
name: payload
required: true
schema:
$ref: '#/definitions/form.ChangePasswordFormPublik'
produces:
- application/json
responses:
"200":
description: Success
schema:
type: boolean
"400":
description: Bad request
schema:
$ref: '#/definitions/utils.RequestError'
"403":
description: Forbidden
schema:
$ref: '#/definitions/utils.RequestError'
"404":
description: Data not found
schema:
$ref: '#/definitions/utils.RequestError'
"422":
description: Data validation failed
schema:
items:
$ref: '#/definitions/utils.RequestError'
type: array
"500":
description: Server error
schema:
$ref: '#/definitions/utils.RequestError'
summary: Amankan Kata Sandi
tags:
- Auth
/auth/login:
post:
consumes:
- application/json
description: Login to get JWT token and refresh token.
operationId: auth-login
parameters:
- description: Login payload
in: body
name: payload
required: true
schema:
$ref: '#/definitions/form.LoginForm'
produces:
- application/json
responses:
"200":
description: Login Success, jwt provided
schema:
$ref: '#/definitions/http_util.JSONResultLogin'
"400":
description: Bad request
schema:
$ref: '#/definitions/utils.RequestError'
"403":
description: Login forbidden
schema:
$ref: '#/definitions/utils.LoginError'
"404":
description: Data not found
schema:
$ref: '#/definitions/utils.RequestError'
"422":
description: Data validation failed
schema:
items:
$ref: '#/definitions/utils.RequestError'
type: array
"500":
description: Server error
schema:
$ref: '#/definitions/utils.RequestError'
summary: user login
tags:
- Auth
/auth/pre-login:
post:
consumes:
- application/json
description: Login to get JWT token and refresh token.
operationId: auth-pre-login
parameters:
- description: Pre login payload
in: body
name: payload
required: true
schema:
$ref: '#/definitions/form.PreLoginForm'
produces:
- application/json
responses:
"200":
description: Success
schema:
items:
$ref: '#/definitions/models.PreLoginModel'
type: array
"400":
description: Bad request
schema:
$ref: '#/definitions/utils.RequestError'
"403":
description: Login forbidden
schema:
$ref: '#/definitions/utils.LoginError'
"404":
description: Data not found
schema:
$ref: '#/definitions/utils.RequestError'
"422":
description: Data validation failed
schema:
items:
$ref: '#/definitions/utils.RequestError'
type: array
"500":
description: Server error
schema:
$ref: '#/definitions/utils.RequestError'
summary: user login
tags:
- Auth
/auth/register:
post:
consumes:
- application/json
description: Register user.
operationId: auth-register
parameters:
- description: Register payload
in: body
name: payload
required: true
schema:
$ref: '#/definitions/form.SignupForm'
produces:
- application/json
responses:
"200":
description: Register Success
schema:
type: boolean
"400":
description: Bad request
schema:
$ref: '#/definitions/utils.RequestError'
"404":
description: Data not found
schema:
$ref: '#/definitions/utils.RequestError'
"422":
description: Data validation failed
schema:
items:
$ref: '#/definitions/utils.RequestError'
type: array
"500":
description: Server error
schema:
$ref: '#/definitions/utils.RequestError'
summary: user register
tags:
- Auth
/auth/token-refresh/{token}:
post:
description: Refresh token to get new valid JWT token and refresh token
operationId: auth-refresh-token
parameters:
- description: Payload
in: body
name: payload
required: true
schema:
$ref: '#/definitions/form.RefreshTokenForm'
produces:
- application/json
responses:
"200":
description: Refresh Token Success, new JWT token provided
schema:
$ref: '#/definitions/models.ResponseLogin'
"400":
description: Bad request
schema:
$ref: '#/definitions/utils.RequestError'
"404":
description: Data not found
schema:
$ref: '#/definitions/utils.RequestError'
"422":
description: Data validation failed
schema:
items:
$ref: '#/definitions/utils.RequestError'
type: array
"500":
description: Server error
schema:
$ref: '#/definitions/utils.RequestError'
summary: Refresh Token
tags:
- Auth
/captcha/new:
get:
consumes:
- application/json
description: generate new captcha.
produces:
- application/json
responses:
"200":
description: Base64 image string
schema: {}
"400":
description: Bad request
schema:
$ref: '#/definitions/utils.RequestError'
"403":
description: Login forbidden
schema:
$ref: '#/definitions/utils.LoginError'
"404":
description: Data not found
schema:
$ref: '#/definitions/utils.RequestError'
"422":
description: Data validation failed
schema:
items:
$ref: '#/definitions/utils.RequestError'
type: array
"500":
description: Server error
schema:
$ref: '#/definitions/utils.RequestError'
summary: generate new captcha
tags:
- Captcha
/captcha/reload/{id}:
get:
consumes:
- application/json
description: reload captcha.
parameters:
- description: captcha ID
in: path
name: id
required: true
type: string
produces:
- application/json
responses:
"200":
description: Base64 image string
schema: {}
"400":
description: Bad request
schema:
$ref: '#/definitions/utils.RequestError'
"403":
description: Login forbidden
schema:
$ref: '#/definitions/utils.LoginError'
"404":
description: Data not found
schema:
$ref: '#/definitions/utils.RequestError'
"422":
description: Data validation failed
schema:
items:
$ref: '#/definitions/utils.RequestError'
type: array
"500":
description: Server error
schema:
$ref: '#/definitions/utils.RequestError'
summary: reload captcha
tags:
- Captcha
/captcha/validate:
post:
consumes:
- application/json
description: validate captcha.
parameters:
- description: payload
in: body
name: payload
required: true
schema:
$ref: '#/definitions/models.ValidateCaptcha'
produces:
- application/json
responses:
"200":
description: validate success
schema:
type: boolean
"400":
description: Bad request
schema:
$ref: '#/definitions/utils.RequestError'
"403":
description: Login forbidden
schema:
$ref: '#/definitions/utils.LoginError'
"404":
description: Data not found
schema:
$ref: '#/definitions/utils.RequestError'
"422":
description: Data validation failed
schema:
items:
$ref: '#/definitions/utils.RequestError'
type: array
"500":
description: Server error
schema:
$ref: '#/definitions/utils.RequestError'
summary: validate captcha
tags:
- Captcha
/site/index:
get:
consumes:
- application/json
description: index page.
operationId: index
produces:
- application/json
responses:
"200":
description: Success
schema: {}
"400":
description: Bad request
schema:
$ref: '#/definitions/utils.RequestError'
"403":
description: Login forbidden
schema:
$ref: '#/definitions/utils.LoginError'
"404":
description: Data not found
schema:
$ref: '#/definitions/utils.RequestError'
"422":
description: Data validation failed
schema:
items:
$ref: '#/definitions/utils.RequestError'
type: array
"500":
description: Server error
schema:
$ref: '#/definitions/utils.RequestError'
summary: index
tags:
- Site
/strict/user/change-password:
post:
description: change password.
operationId: user-change-password
parameters:
- description: Payload
in: body
name: payload
required: true
schema:
$ref: '#/definitions/form.ChangePasswordForm'
produces:
- application/json
responses:
"200":
description: Success
schema:
type: boolean
"400":
description: Bad request
schema:
$ref: '#/definitions/utils.RequestError'
"403":
description: Forbidden
schema:
$ref: '#/definitions/utils.RequestError'
"404":
description: Data not found
schema:
$ref: '#/definitions/utils.RequestError'
"422":
description: Data validation failed
schema:
items:
$ref: '#/definitions/utils.RequestError'
type: array
"500":
description: Server error
schema:
$ref: '#/definitions/utils.RequestError'
security:
- ApiKeyAuth: []
summary: change password
tags:
- User
/strict/user/generate-password-hash:
post:
description: generate password hash.
operationId: user-generate-password-hash
parameters:
- description: Payload
in: body
name: payload
required: true
schema:
$ref: '#/definitions/form.GenerateHashForm'
produces:
- application/json
responses:
"200":
description: Success
schema:
type: boolean
"400":
description: Bad request
schema:
$ref: '#/definitions/utils.RequestError'
"403":
description: Forbidden
schema:
$ref: '#/definitions/utils.RequestError'
"404":
description: Data not found
schema:
$ref: '#/definitions/utils.RequestError'
"422":
description: Data validation failed
schema:
items:
$ref: '#/definitions/utils.RequestError'
type: array
"500":
description: Server error
schema:
$ref: '#/definitions/utils.RequestError'
security:
- ApiKeyAuth: []
summary: generate password hash
tags:
- User
/strict/user/logout:
get:
description: user logout.
operationId: user-logout
produces:
- application/json
responses:
"200":
description: Success
schema:
type: boolean
"400":
description: Bad request
schema:
$ref: '#/definitions/utils.RequestError'
"403":
description: Forbidden
schema:
$ref: '#/definitions/utils.RequestError'
"404":
description: Data not found
schema:
$ref: '#/definitions/utils.RequestError'
"422":
description: Data validation failed
schema:
items:
$ref: '#/definitions/utils.RequestError'
type: array
"500":
description: Server error
schema:
$ref: '#/definitions/utils.RequestError'
security:
- ApiKeyAuth: []
summary: logout
tags:
- User
/strict/user/profile:
get:
description: get profile info.
operationId: user-profile
produces:
- application/json
responses:
"200":
description: Success
schema:
$ref: '#/definitions/models.UserDetail'
"400":
description: Bad request
schema:
$ref: '#/definitions/utils.RequestError'
"404":
description: Data not found
schema:
$ref: '#/definitions/utils.RequestError'
"422":
description: Data validation failed
schema:
items:
$ref: '#/definitions/utils.RequestError'
type: array
"500":
description: Server error
schema:
$ref: '#/definitions/utils.RequestError'
security:
- ApiKeyAuth: []
summary: user get profile info
tags:
- User
/strict/user/update-profile:
put:
description: update profile.
parameters:
- description: Payload
in: body
name: payload
required: true
schema:
$ref: '#/definitions/form.UpdateUserProfileForm'
produces:
- application/json
responses:
"200":
description: Success
schema:
type: boolean
"400":
description: Bad request
schema:
$ref: '#/definitions/utils.RequestError'
"404":
description: Data not found
schema:
$ref: '#/definitions/utils.RequestError'
"422":
description: Data validation failed
schema:
items:
$ref: '#/definitions/utils.RequestError'
type: array
"500":
description: Server error
schema:
$ref: '#/definitions/utils.RequestError'
security:
- ApiKeyAuth: []
summary: update profile
tags:
- User
/strict/user/upload-avatar:
post:
consumes:
- application/x-www-form-urlencoded
description: upload avatar
operationId: user-upload avatar
parameters:
- description: Image avatar
in: formData
name: file
required: true
type: file
produces:
- application/json
responses:
"200":
description: Success
schema:
type: boolean
"400":
description: Bad request
schema:
$ref: '#/definitions/utils.RequestError'
"403":
description: Forbidden
schema:
$ref: '#/definitions/utils.RequestError'
"404":
description: Data not found
schema:
$ref: '#/definitions/utils.RequestError'
"422":
description: Data validation failed
schema:
items:
$ref: '#/definitions/utils.RequestError'
type: array
"500":
description: Server error
schema:
$ref: '#/definitions/utils.RequestError'
security:
- ApiKeyAuth: []
summary: upload avatar
tags:
- User
securityDefinitions:
ApiKeyAuth:
in: header
name: Authorization
type: apiKey
swagger: "2.0"