Skip to content

Commit f7e7342

Browse files
authored
Merge pull request #109 from thand-io/new-discovery-endpoint
new discovery endpoint for agents
2 parents 1b210db + ee4aa49 commit f7e7342

17 files changed

Lines changed: 428 additions & 142 deletions

File tree

cmd/cli/request.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ var requestCmd = &cobra.Command{
4949

5050
fmt.Println(successStyle.Render("Generating request .."))
5151

52-
loginServer := strings.TrimSuffix(cfg.GetLoginServerApiUrl(), "/")
52+
loginServer := strings.TrimSuffix(cfg.DiscoverLoginServerApiUrl(), "/")
5353
evaluateReason := fmt.Sprintf("%s/elevate/llm", loginServer)
5454

5555
client := resty.New()

docs/docs.go

Lines changed: 107 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,30 @@ const docTemplate = `{
2424
"host": "{{.Host}}",
2525
"basePath": "{{.BasePath}}",
2626
"paths": {
27+
"/.well-known/api-configuration": {
28+
"get": {
29+
"description": "Get service configuration including endpoints, capabilities, and authentication methods",
30+
"consumes": [
31+
"application/json"
32+
],
33+
"produces": [
34+
"application/json"
35+
],
36+
"tags": [
37+
"discovery"
38+
],
39+
"summary": "API configuration",
40+
"responses": {
41+
"200": {
42+
"description": "API configuration",
43+
"schema": {
44+
"type": "object",
45+
"additionalProperties": true
46+
}
47+
}
48+
}
49+
}
50+
},
2751
"/auth": {
2852
"get": {
2953
"description": "Display the authentication page with available providers",
@@ -3009,6 +3033,10 @@ const docTemplate = `{
30093033
"type": "boolean",
30103034
"default": false
30113035
},
3036+
"hostname": {
3037+
"type": "string",
3038+
"default": "localhost"
3039+
},
30123040
"metaData": {
30133041
"description": "Metadata for the environment",
30143042
"allOf": [
@@ -3060,6 +3088,23 @@ const docTemplate = `{
30603088
"Local"
30613089
]
30623090
},
3091+
"models.Groups": {
3092+
"type": "object",
3093+
"properties": {
3094+
"allow": {
3095+
"type": "array",
3096+
"items": {
3097+
"type": "string"
3098+
}
3099+
},
3100+
"deny": {
3101+
"type": "array",
3102+
"items": {
3103+
"type": "string"
3104+
}
3105+
}
3106+
}
3107+
},
30633108
"models.HealthResponse": {
30643109
"type": "object",
30653110
"properties": {
@@ -3345,7 +3390,16 @@ const docTemplate = `{
33453390
"type": "boolean",
33463391
"default": true
33473392
},
3393+
"groups": {
3394+
"description": "groups to add the user to",
3395+
"allOf": [
3396+
{
3397+
"$ref": "#/definitions/models.Groups"
3398+
}
3399+
]
3400+
},
33483401
"inherits": {
3402+
"description": "roles to inherit from or provider specific roles/policies etc",
33493403
"type": "array",
33503404
"items": {
33513405
"type": "string"
@@ -3355,19 +3409,35 @@ const docTemplate = `{
33553409
"type": "string"
33563410
},
33573411
"permissions": {
3358-
"$ref": "#/definitions/models.Permissions"
3412+
"description": "granular permissions for the role",
3413+
"allOf": [
3414+
{
3415+
"$ref": "#/definitions/models.Permissions"
3416+
}
3417+
]
33593418
},
33603419
"providers": {
3420+
"description": "providers that can assign this role",
33613421
"type": "array",
33623422
"items": {
33633423
"type": "string"
33643424
}
33653425
},
33663426
"resources": {
3367-
"$ref": "#/definitions/models.Resources"
3427+
"description": "resource access rules, apis, files, systems etc",
3428+
"allOf": [
3429+
{
3430+
"$ref": "#/definitions/models.Resources"
3431+
}
3432+
]
33683433
},
33693434
"scopes": {
3370-
"$ref": "#/definitions/models.RoleScopes"
3435+
"description": "scope of who can be assigned this role",
3436+
"allOf": [
3437+
{
3438+
"$ref": "#/definitions/models.RoleScopes"
3439+
}
3440+
]
33713441
},
33723442
"workflows": {
33733443
"description": "The workflows to execute",
@@ -3396,7 +3466,16 @@ const docTemplate = `{
33963466
"type": "boolean",
33973467
"default": true
33983468
},
3469+
"groups": {
3470+
"description": "groups to add the user to",
3471+
"allOf": [
3472+
{
3473+
"$ref": "#/definitions/models.Groups"
3474+
}
3475+
]
3476+
},
33993477
"inherits": {
3478+
"description": "roles to inherit from or provider specific roles/policies etc",
34003479
"type": "array",
34013480
"items": {
34023481
"type": "string"
@@ -3406,19 +3485,35 @@ const docTemplate = `{
34063485
"type": "string"
34073486
},
34083487
"permissions": {
3409-
"$ref": "#/definitions/models.Permissions"
3488+
"description": "granular permissions for the role",
3489+
"allOf": [
3490+
{
3491+
"$ref": "#/definitions/models.Permissions"
3492+
}
3493+
]
34103494
},
34113495
"providers": {
3496+
"description": "providers that can assign this role",
34123497
"type": "array",
34133498
"items": {
34143499
"type": "string"
34153500
}
34163501
},
34173502
"resources": {
3418-
"$ref": "#/definitions/models.Resources"
3503+
"description": "resource access rules, apis, files, systems etc",
3504+
"allOf": [
3505+
{
3506+
"$ref": "#/definitions/models.Resources"
3507+
}
3508+
]
34193509
},
34203510
"scopes": {
3421-
"$ref": "#/definitions/models.RoleScopes"
3511+
"description": "scope of who can be assigned this role",
3512+
"allOf": [
3513+
{
3514+
"$ref": "#/definitions/models.RoleScopes"
3515+
}
3516+
]
34223517
},
34233518
"workflows": {
34243519
"description": "The workflows to execute",
@@ -3432,6 +3527,12 @@ const docTemplate = `{
34323527
"models.RoleScopes": {
34333528
"type": "object",
34343529
"properties": {
3530+
"domains": {
3531+
"type": "array",
3532+
"items": {
3533+
"type": "string"
3534+
}
3535+
},
34353536
"groups": {
34363537
"type": "array",
34373538
"items": {

docs/swagger.json

Lines changed: 107 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,30 @@
2222
"host": "localhost:8080",
2323
"basePath": "/api/v1",
2424
"paths": {
25+
"/.well-known/api-configuration": {
26+
"get": {
27+
"description": "Get service configuration including endpoints, capabilities, and authentication methods",
28+
"consumes": [
29+
"application/json"
30+
],
31+
"produces": [
32+
"application/json"
33+
],
34+
"tags": [
35+
"discovery"
36+
],
37+
"summary": "API configuration",
38+
"responses": {
39+
"200": {
40+
"description": "API configuration",
41+
"schema": {
42+
"type": "object",
43+
"additionalProperties": true
44+
}
45+
}
46+
}
47+
}
48+
},
2549
"/auth": {
2650
"get": {
2751
"description": "Display the authentication page with available providers",
@@ -3007,6 +3031,10 @@
30073031
"type": "boolean",
30083032
"default": false
30093033
},
3034+
"hostname": {
3035+
"type": "string",
3036+
"default": "localhost"
3037+
},
30103038
"metaData": {
30113039
"description": "Metadata for the environment",
30123040
"allOf": [
@@ -3058,6 +3086,23 @@
30583086
"Local"
30593087
]
30603088
},
3089+
"models.Groups": {
3090+
"type": "object",
3091+
"properties": {
3092+
"allow": {
3093+
"type": "array",
3094+
"items": {
3095+
"type": "string"
3096+
}
3097+
},
3098+
"deny": {
3099+
"type": "array",
3100+
"items": {
3101+
"type": "string"
3102+
}
3103+
}
3104+
}
3105+
},
30613106
"models.HealthResponse": {
30623107
"type": "object",
30633108
"properties": {
@@ -3343,7 +3388,16 @@
33433388
"type": "boolean",
33443389
"default": true
33453390
},
3391+
"groups": {
3392+
"description": "groups to add the user to",
3393+
"allOf": [
3394+
{
3395+
"$ref": "#/definitions/models.Groups"
3396+
}
3397+
]
3398+
},
33463399
"inherits": {
3400+
"description": "roles to inherit from or provider specific roles/policies etc",
33473401
"type": "array",
33483402
"items": {
33493403
"type": "string"
@@ -3353,19 +3407,35 @@
33533407
"type": "string"
33543408
},
33553409
"permissions": {
3356-
"$ref": "#/definitions/models.Permissions"
3410+
"description": "granular permissions for the role",
3411+
"allOf": [
3412+
{
3413+
"$ref": "#/definitions/models.Permissions"
3414+
}
3415+
]
33573416
},
33583417
"providers": {
3418+
"description": "providers that can assign this role",
33593419
"type": "array",
33603420
"items": {
33613421
"type": "string"
33623422
}
33633423
},
33643424
"resources": {
3365-
"$ref": "#/definitions/models.Resources"
3425+
"description": "resource access rules, apis, files, systems etc",
3426+
"allOf": [
3427+
{
3428+
"$ref": "#/definitions/models.Resources"
3429+
}
3430+
]
33663431
},
33673432
"scopes": {
3368-
"$ref": "#/definitions/models.RoleScopes"
3433+
"description": "scope of who can be assigned this role",
3434+
"allOf": [
3435+
{
3436+
"$ref": "#/definitions/models.RoleScopes"
3437+
}
3438+
]
33693439
},
33703440
"workflows": {
33713441
"description": "The workflows to execute",
@@ -3394,7 +3464,16 @@
33943464
"type": "boolean",
33953465
"default": true
33963466
},
3467+
"groups": {
3468+
"description": "groups to add the user to",
3469+
"allOf": [
3470+
{
3471+
"$ref": "#/definitions/models.Groups"
3472+
}
3473+
]
3474+
},
33973475
"inherits": {
3476+
"description": "roles to inherit from or provider specific roles/policies etc",
33983477
"type": "array",
33993478
"items": {
34003479
"type": "string"
@@ -3404,19 +3483,35 @@
34043483
"type": "string"
34053484
},
34063485
"permissions": {
3407-
"$ref": "#/definitions/models.Permissions"
3486+
"description": "granular permissions for the role",
3487+
"allOf": [
3488+
{
3489+
"$ref": "#/definitions/models.Permissions"
3490+
}
3491+
]
34083492
},
34093493
"providers": {
3494+
"description": "providers that can assign this role",
34103495
"type": "array",
34113496
"items": {
34123497
"type": "string"
34133498
}
34143499
},
34153500
"resources": {
3416-
"$ref": "#/definitions/models.Resources"
3501+
"description": "resource access rules, apis, files, systems etc",
3502+
"allOf": [
3503+
{
3504+
"$ref": "#/definitions/models.Resources"
3505+
}
3506+
]
34173507
},
34183508
"scopes": {
3419-
"$ref": "#/definitions/models.RoleScopes"
3509+
"description": "scope of who can be assigned this role",
3510+
"allOf": [
3511+
{
3512+
"$ref": "#/definitions/models.RoleScopes"
3513+
}
3514+
]
34203515
},
34213516
"workflows": {
34223517
"description": "The workflows to execute",
@@ -3430,6 +3525,12 @@
34303525
"models.RoleScopes": {
34313526
"type": "object",
34323527
"properties": {
3528+
"domains": {
3529+
"type": "array",
3530+
"items": {
3531+
"type": "string"
3532+
}
3533+
},
34333534
"groups": {
34343535
"type": "array",
34353536
"items": {

0 commit comments

Comments
 (0)