mirror of
https://github.com/balzack/databag.git
synced 2025-02-12 03:29:16 +00:00
preparing account authorization
This commit is contained in:
parent
22d6c74f9a
commit
12dfca0da3
30
doc/api.oa3
30
doc/api.oa3
@ -4030,7 +4030,7 @@ components:
|
|||||||
$ref: '#/components/schemas/AppData'
|
$ref: '#/components/schemas/AppData'
|
||||||
attached:
|
attached:
|
||||||
type: integer
|
type: integer
|
||||||
format: int32
|
format: int64
|
||||||
|
|
||||||
AppData:
|
AppData:
|
||||||
type: object
|
type: object
|
||||||
@ -4164,7 +4164,7 @@ components:
|
|||||||
type: string
|
type: string
|
||||||
created:
|
created:
|
||||||
type: integer
|
type: integer
|
||||||
format: int32
|
format: int64
|
||||||
|
|
||||||
Insight:
|
Insight:
|
||||||
type: object
|
type: object
|
||||||
@ -4208,7 +4208,7 @@ components:
|
|||||||
type: string
|
type: string
|
||||||
created:
|
created:
|
||||||
type: integer
|
type: integer
|
||||||
format: int32
|
format: int64
|
||||||
active:
|
active:
|
||||||
type: boolean
|
type: boolean
|
||||||
insightRevision:
|
insightRevision:
|
||||||
@ -4263,10 +4263,10 @@ components:
|
|||||||
type: string
|
type: string
|
||||||
created:
|
created:
|
||||||
type: integer
|
type: integer
|
||||||
format: int32
|
format: int64
|
||||||
modified:
|
modified:
|
||||||
type: integer
|
type: integer
|
||||||
format: int32
|
format: int64
|
||||||
status:
|
status:
|
||||||
type: string
|
type: string
|
||||||
enum: [ unconfirmed, confirmed, complete, error ]
|
enum: [ unconfirmed, confirmed, complete, error ]
|
||||||
@ -4275,7 +4275,7 @@ components:
|
|||||||
format: int32
|
format: int32
|
||||||
tagUpdate:
|
tagUpdate:
|
||||||
type: integer
|
type: integer
|
||||||
format: int32
|
format: int64
|
||||||
tagRevision:
|
tagRevision:
|
||||||
type: integer
|
type: integer
|
||||||
format: int64
|
format: int64
|
||||||
@ -4306,10 +4306,10 @@ components:
|
|||||||
type: string
|
type: string
|
||||||
created:
|
created:
|
||||||
type: integer
|
type: integer
|
||||||
format: int32
|
format: int64
|
||||||
modified:
|
modified:
|
||||||
type: integer
|
type: integer
|
||||||
format: int32
|
format: int64
|
||||||
status:
|
status:
|
||||||
type: string
|
type: string
|
||||||
enum: [ unconfirmed, confirmed, complete, error ]
|
enum: [ unconfirmed, confirmed, complete, error ]
|
||||||
@ -4326,7 +4326,7 @@ components:
|
|||||||
format: int32
|
format: int32
|
||||||
tagUpdate:
|
tagUpdate:
|
||||||
type: integer
|
type: integer
|
||||||
format: int32
|
format: int64
|
||||||
tagRevision:
|
tagRevision:
|
||||||
type: integer
|
type: integer
|
||||||
format: int64
|
format: int64
|
||||||
@ -4352,10 +4352,10 @@ components:
|
|||||||
type: string
|
type: string
|
||||||
created:
|
created:
|
||||||
type: integer
|
type: integer
|
||||||
format: int32
|
format: int64
|
||||||
modified:
|
modified:
|
||||||
type: integer
|
type: integer
|
||||||
format: int32
|
format: int64
|
||||||
|
|
||||||
Label:
|
Label:
|
||||||
type: object
|
type: object
|
||||||
@ -4378,7 +4378,7 @@ components:
|
|||||||
type: string
|
type: string
|
||||||
created:
|
created:
|
||||||
type: integer
|
type: integer
|
||||||
format: int32
|
format: int64
|
||||||
groups: # present only in account holder responses
|
groups: # present only in account holder responses
|
||||||
type: array
|
type: array
|
||||||
items:
|
items:
|
||||||
@ -4397,7 +4397,7 @@ components:
|
|||||||
type: string
|
type: string
|
||||||
timestamp:
|
timestamp:
|
||||||
type: integer
|
type: integer
|
||||||
format: int32
|
format: int64
|
||||||
|
|
||||||
Connect:
|
Connect:
|
||||||
type: object
|
type: object
|
||||||
@ -4415,7 +4415,7 @@ components:
|
|||||||
type: string
|
type: string
|
||||||
timestamp:
|
timestamp:
|
||||||
type: integer
|
type: integer
|
||||||
format: int32
|
format: int64
|
||||||
profile:
|
profile:
|
||||||
$ref: '#/components/schemas/Profile'
|
$ref: '#/components/schemas/Profile'
|
||||||
token:
|
token:
|
||||||
@ -4437,7 +4437,7 @@ components:
|
|||||||
type: string
|
type: string
|
||||||
timestamp:
|
timestamp:
|
||||||
type: integer
|
type: integer
|
||||||
format: int32
|
format: int64
|
||||||
|
|
||||||
DataMessage:
|
DataMessage:
|
||||||
type: object
|
type: object
|
||||||
|
@ -1,24 +1,13 @@
|
|||||||
/*
|
|
||||||
* DataBag
|
|
||||||
*
|
|
||||||
* DataBag provides storage for decentralized identity based self-hosting apps. It is intended to support sharing of personal data and hosting group conversations.
|
|
||||||
*
|
|
||||||
* API version: 0.0.1
|
|
||||||
* Contact: roland.osborne@gmail.com
|
|
||||||
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
|
|
||||||
*/
|
|
||||||
package databag
|
package databag
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Authorize(w http.ResponseWriter, r *http.Request) {
|
func Authorize(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
account, res := BearerAppToken(r);
|
account, res := BearerAppToken(r);
|
||||||
PrintMsg(res);
|
|
||||||
PrintMsg(account);
|
|
||||||
|
|
||||||
if res != nil {
|
if res != nil {
|
||||||
w.WriteHeader(http.StatusUnauthorized)
|
w.WriteHeader(http.StatusUnauthorized)
|
||||||
return
|
return
|
||||||
@ -28,6 +17,24 @@ PrintMsg(account);
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// extract token from body
|
||||||
|
var token string
|
||||||
|
if ParseRequest(r, w, &token) != nil {
|
||||||
|
w.WriteHeader(http.StatusBadRequest);
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// load details to sign data
|
||||||
|
|
||||||
|
|
||||||
|
// generate message
|
||||||
|
auth := Authenticate{
|
||||||
|
Guid: account.Guid,
|
||||||
|
Token: token,
|
||||||
|
Timestamp: time.Now().Unix(),
|
||||||
|
}
|
||||||
|
PrintMsg(auth);
|
||||||
|
|
||||||
w.Header().Set("Content-Type", "application/json; charset=UTF-8")
|
w.Header().Set("Content-Type", "application/json; charset=UTF-8")
|
||||||
w.WriteHeader(http.StatusOK)
|
w.WriteHeader(http.StatusOK)
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ type Announce struct {
|
|||||||
type App struct {
|
type App struct {
|
||||||
AppId string `json:"appId"`
|
AppId string `json:"appId"`
|
||||||
AppData *AppData `json:"appData"`
|
AppData *AppData `json:"appData"`
|
||||||
Attached int32 `json:"attached"`
|
Attached int64 `json:"attached"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type AppData struct {
|
type AppData struct {
|
||||||
@ -43,13 +43,13 @@ type Article struct {
|
|||||||
ArticleRevision int64 `json:"articleRevision"`
|
ArticleRevision int64 `json:"articleRevision"`
|
||||||
Type_ string `json:"type"`
|
Type_ string `json:"type"`
|
||||||
Data string `json:"data"`
|
Data string `json:"data"`
|
||||||
Created int32 `json:"created"`
|
Created int64 `json:"created"`
|
||||||
Modified int32 `json:"modified"`
|
Modified int64 `json:"modified"`
|
||||||
Status string `json:"status"`
|
Status string `json:"status"`
|
||||||
Labels []string `json:"labels"`
|
Labels []string `json:"labels"`
|
||||||
Groups []string `json:"groups,omitempty"`
|
Groups []string `json:"groups,omitempty"`
|
||||||
TagCount int32 `json:"tagCount"`
|
TagCount int32 `json:"tagCount"`
|
||||||
TagUpdate int32 `json:"tagUpdate,omitempty"`
|
TagUpdate int64 `json:"tagUpdate,omitempty"`
|
||||||
TagRevision int64 `json:"tagRevision"`
|
TagRevision int64 `json:"tagRevision"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,7 +71,7 @@ type Asset struct {
|
|||||||
type Authenticate struct {
|
type Authenticate struct {
|
||||||
Guid string `json:"guid"`
|
Guid string `json:"guid"`
|
||||||
Token string `json:"token"`
|
Token string `json:"token"`
|
||||||
Timestamp int32 `json:"timestamp"`
|
Timestamp int64 `json:"timestamp"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type Card struct {
|
type Card struct {
|
||||||
@ -110,7 +110,7 @@ type CardView struct {
|
|||||||
type Connect struct {
|
type Connect struct {
|
||||||
RequestorcardId string `json:"requestorcardId,omitempty"`
|
RequestorcardId string `json:"requestorcardId,omitempty"`
|
||||||
RequestedcardId string `json:"requestedcardId,omitempty"`
|
RequestedcardId string `json:"requestedcardId,omitempty"`
|
||||||
Timestamp int32 `json:"timestamp"`
|
Timestamp int64 `json:"timestamp"`
|
||||||
Profile *Profile `json:"profile"`
|
Profile *Profile `json:"profile"`
|
||||||
Token string `json:"token"`
|
Token string `json:"token"`
|
||||||
ContentRevision int64 `json:"contentRevision"`
|
ContentRevision int64 `json:"contentRevision"`
|
||||||
@ -139,7 +139,7 @@ type Dialogue struct {
|
|||||||
DialogueRevison int64 `json:"dialogueRevison,omitempty"`
|
DialogueRevison int64 `json:"dialogueRevison,omitempty"`
|
||||||
Type_ string `json:"type"`
|
Type_ string `json:"type"`
|
||||||
Data string `json:"data"`
|
Data string `json:"data"`
|
||||||
Created int32 `json:"created"`
|
Created int64 `json:"created"`
|
||||||
Active bool `json:"active"`
|
Active bool `json:"active"`
|
||||||
InsightRevision int64 `json:"insightRevision,omitempty"`
|
InsightRevision int64 `json:"insightRevision,omitempty"`
|
||||||
Insights []DialogueInsights `json:"insights"`
|
Insights []DialogueInsights `json:"insights"`
|
||||||
@ -158,7 +158,7 @@ type DialogueInsights struct {
|
|||||||
type Disconnect struct {
|
type Disconnect struct {
|
||||||
RequestorId string `json:"requestorId"`
|
RequestorId string `json:"requestorId"`
|
||||||
RequestedId string `json:"requestedId"`
|
RequestedId string `json:"requestedId"`
|
||||||
Timestamp int32 `json:"timestamp"`
|
Timestamp int64 `json:"timestamp"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type Group struct {
|
type Group struct {
|
||||||
@ -166,8 +166,8 @@ type Group struct {
|
|||||||
GroupRevision int64 `json:"groupRevision"`
|
GroupRevision int64 `json:"groupRevision"`
|
||||||
Type_ string `json:"type"`
|
Type_ string `json:"type"`
|
||||||
Data string `json:"data"`
|
Data string `json:"data"`
|
||||||
Created int32 `json:"created"`
|
Created int64 `json:"created"`
|
||||||
Modified int32 `json:"modified"`
|
Modified int64 `json:"modified"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type GroupsGroupIdBody struct {
|
type GroupsGroupIdBody struct {
|
||||||
@ -215,7 +215,7 @@ type Label struct {
|
|||||||
LabelRevision int64 `json:"labelRevision"`
|
LabelRevision int64 `json:"labelRevision"`
|
||||||
Type_ string `json:"type"`
|
Type_ string `json:"type"`
|
||||||
Data string `json:"data"`
|
Data string `json:"data"`
|
||||||
Created int32 `json:"created"`
|
Created int64 `json:"created"`
|
||||||
Groups []string `json:"groups,omitempty"`
|
Groups []string `json:"groups,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -271,7 +271,7 @@ type Tag struct {
|
|||||||
Revision int64 `json:"revision"`
|
Revision int64 `json:"revision"`
|
||||||
Type_ string `json:"type"`
|
Type_ string `json:"type"`
|
||||||
Data string `json:"data"`
|
Data string `json:"data"`
|
||||||
Created int32 `json:"created"`
|
Created int64 `json:"created"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type Topic struct {
|
type Topic struct {
|
||||||
@ -279,11 +279,11 @@ type Topic struct {
|
|||||||
TopicRevision int64 `json:"topicRevision"`
|
TopicRevision int64 `json:"topicRevision"`
|
||||||
Type_ string `json:"type"`
|
Type_ string `json:"type"`
|
||||||
Data string `json:"data"`
|
Data string `json:"data"`
|
||||||
Created int32 `json:"created"`
|
Created int64 `json:"created"`
|
||||||
Modified int32 `json:"modified"`
|
Modified int64 `json:"modified"`
|
||||||
Status string `json:"status"`
|
Status string `json:"status"`
|
||||||
TagCount int32 `json:"tagCount"`
|
TagCount int32 `json:"tagCount"`
|
||||||
TagUpdate int32 `json:"tagUpdate,omitempty"`
|
TagUpdate int64 `json:"tagUpdate,omitempty"`
|
||||||
TagRevision int64 `json:"tagRevision"`
|
TagRevision int64 `json:"tagRevision"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user