mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-12 19:14:23 +00:00
5699fe80d5
* feat: check oidc compliance * fix: add tests * fix: add oidc config tests * fix: add oidc config tests user agent * fix: test oidc config compliance * fix: test oidc config compliance * fix: useragent implicit authmethod none * fix: merge master * feat: translate compliance problems * feat: check native app for custom url * fix: better compliance handling * fix: better compliance handling * feat: add odidc dev mode * fix: remove deprecated request fro management api * fix: oidc package version * fix: migration * fix: tests * fix: remove unused functions * fix: generate proto files * fix: native implicit and code none compliant * fix: create project * Update internal/project/model/oidc_config_test.go Co-authored-by: Livio Amstutz <livio.a@gmail.com> * fix: tests * Update internal/project/model/oidc_config.go Co-authored-by: Livio Amstutz <livio.a@gmail.com> * Update internal/project/model/oidc_config.go Co-authored-by: Livio Amstutz <livio.a@gmail.com> * fix: tests Co-authored-by: Livio Amstutz <livio.a@gmail.com>
84 lines
3.0 KiB
Go
84 lines
3.0 KiB
Go
package management
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/golang/protobuf/ptypes/empty"
|
|
|
|
"github.com/caos/zitadel/pkg/grpc/management"
|
|
)
|
|
|
|
func (s *Server) SearchApplications(ctx context.Context, in *management.ApplicationSearchRequest) (*management.ApplicationSearchResponse, error) {
|
|
response, err := s.project.SearchApplications(ctx, applicationSearchRequestsToModel(in))
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return applicationSearchResponseFromModel(response), nil
|
|
}
|
|
|
|
func (s *Server) ApplicationByID(ctx context.Context, in *management.ApplicationID) (*management.ApplicationView, error) {
|
|
app, err := s.project.ApplicationByID(ctx, in.ProjectId, in.Id)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return applicationViewFromModel(app), nil
|
|
}
|
|
|
|
func (s *Server) CreateOIDCApplication(ctx context.Context, in *management.OIDCApplicationCreate) (*management.Application, error) {
|
|
app, err := s.project.AddApplication(ctx, oidcAppCreateToModel(in))
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return appFromModel(app), nil
|
|
}
|
|
func (s *Server) UpdateApplication(ctx context.Context, in *management.ApplicationUpdate) (*management.Application, error) {
|
|
app, err := s.project.ChangeApplication(ctx, appUpdateToModel(in))
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return appFromModel(app), nil
|
|
}
|
|
func (s *Server) DeactivateApplication(ctx context.Context, in *management.ApplicationID) (*management.Application, error) {
|
|
app, err := s.project.DeactivateApplication(ctx, in.ProjectId, in.Id)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return appFromModel(app), nil
|
|
}
|
|
func (s *Server) ReactivateApplication(ctx context.Context, in *management.ApplicationID) (*management.Application, error) {
|
|
app, err := s.project.ReactivateApplication(ctx, in.ProjectId, in.Id)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return appFromModel(app), nil
|
|
}
|
|
|
|
func (s *Server) RemoveApplication(ctx context.Context, in *management.ApplicationID) (*empty.Empty, error) {
|
|
err := s.project.RemoveApplication(ctx, in.ProjectId, in.Id)
|
|
return &empty.Empty{}, err
|
|
}
|
|
|
|
func (s *Server) UpdateApplicationOIDCConfig(ctx context.Context, in *management.OIDCConfigUpdate) (*management.OIDCConfig, error) {
|
|
config, err := s.project.ChangeOIDCConfig(ctx, oidcConfigUpdateToModel(in))
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return oidcConfigFromModel(config), nil
|
|
}
|
|
|
|
func (s *Server) RegenerateOIDCClientSecret(ctx context.Context, in *management.ApplicationID) (*management.ClientSecret, error) {
|
|
config, err := s.project.ChangeOIDConfigSecret(ctx, in.ProjectId, in.Id)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &management.ClientSecret{ClientSecret: config.ClientSecretString}, nil
|
|
}
|
|
|
|
func (s *Server) ApplicationChanges(ctx context.Context, changesRequest *management.ChangeRequest) (*management.Changes, error) {
|
|
response, err := s.project.ApplicationChanges(ctx, changesRequest.Id, changesRequest.SecId, changesRequest.SequenceOffset, changesRequest.Limit, changesRequest.Asc)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return appChangesToResponse(response, changesRequest.GetSequenceOffset(), changesRequest.GetLimit()), nil
|
|
}
|