Add api support for external authentication management#34234
Add api support for external authentication management#34234uvulpos wants to merge 27 commits intogo-gitea:mainfrom
Conversation
…thub.com:uvulpos/gitea into feat/add-oauth-management-to-api-for-iac-tooling
| m.Patch("/{id}", bind(api.EditAuthOauth2Option{}), admin.EditOauthAuth) | ||
| m.Delete("/{id}", admin.DeleteOauthAuth) |
There was a problem hiding this comment.
parameter via url or url param?
There was a problem hiding this comment.
Unless someone else has different opinion I think it should stay like this.
What about getting the current configuration for an ID?
There was a problem hiding this comment.
But what's the current configuration? We can have n login sources configured and you can access it via pat so no auth source is getting used at all
Ok, I'll add this feature to get a config by ID
routers/api/v1/admin/auth_oauth.go
Outdated
|
|
||
| listOptions := utils.GetListOptions(ctx) | ||
|
|
||
| authSources, maxResults, err := db.FindAndCount[auth_model.Source](ctx, auth_model.FindSourcesOptions{}) |
There was a problem hiding this comment.
Filter and return just type OAuth
[Help appreciated]
There was a problem hiding this comment.
I'm not sure search is needed? Second opinion would be nice this though.
There was a problem hiding this comment.
The url explicit says oauth, so I'm not sure if I want to receive LDAP connections
There was a problem hiding this comment.
To filter for oauth only you should add LoginType: auth_model.OAuth2 to the struct.
But I was wondering why oauth search specifically instead of more generic one? The struct doesn't really let you filter by much more too.
TheFox0x7
left a comment
There was a problem hiding this comment.
I haven't tested the changes yet or looked too deep into it, at a glance it looks like it's a good starting point.
In case you haven't yet seen it: https://github.com/go-gitea/gitea/blob/main/cmd/admin_auth_oauth.go covers cli endpoint for adding oauth, which you might find useful.
Few minor points:
- copyright date in new files should be from this year and I don't think gogs attribution here is needed(?)
- comments in
services/convert/auth_oauth.godon't match the functions
modules/structs/auth_oauth2.go
Outdated
| Type int `json:"type"` | ||
| TypeName string `json:"type_name"` |
There was a problem hiding this comment.
I'm not sure why end user would be interested in numeric type?
There was a problem hiding this comment.
I was not sure, but I think it's more unique than the name for machine readability. But... I don't know. Opinions are welcome :)
| m.Patch("/{id}", bind(api.EditAuthOauth2Option{}), admin.EditOauthAuth) | ||
| m.Delete("/{id}", admin.DeleteOauthAuth) |
There was a problem hiding this comment.
Unless someone else has different opinion I think it should stay like this.
What about getting the current configuration for an ID?
routers/api/v1/admin/auth_oauth.go
Outdated
|
|
||
| listOptions := utils.GetListOptions(ctx) | ||
|
|
||
| authSources, maxResults, err := db.FindAndCount[auth_model.Source](ctx, auth_model.FindSourcesOptions{}) |
There was a problem hiding this comment.
I'm not sure search is needed? Second opinion would be nice this though.
…uth authentication
…thub.com:uvulpos/gitea into feat/add-oauth-management-to-api-for-iac-tooling
…thub.com:uvulpos/gitea into feat/add-oauth-management-to-api-for-iac-tooling
…ourceOption usage
…thub.com:uvulpos/gitea into feat/add-oauth-management-to-api-for-iac-tooling
|
I'm a bit confused on how to fix the swagger issue. A little help is appreciated |
|
You need to run |
|
That's not the issue. Somewhere in the code, there is an issue, so it won't run, and im not so sure how to fix it |
Summary:
As a DevOps Engineer, I want an automatic infrastructure setup with terraform and therefor have to enhance the gitea external api.
API:
Terraform (later):
Todos:
Get Configuration by IDOther:
This is my first contribution to gitea so any help is appreciated