2022-02-25 15:05:06 +00:00
|
|
|
package admin
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
2022-04-26 23:01:45 +00:00
|
|
|
"github.com/zitadel/zitadel/internal/api/authz"
|
|
|
|
"github.com/zitadel/zitadel/internal/api/grpc/object"
|
|
|
|
admin_pb "github.com/zitadel/zitadel/pkg/grpc/admin"
|
2022-02-25 15:05:06 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func (s *Server) GetOIDCSettings(ctx context.Context, _ *admin_pb.GetOIDCSettingsRequest) (*admin_pb.GetOIDCSettingsResponse, error) {
|
2022-04-05 05:58:09 +00:00
|
|
|
result, err := s.query.OIDCSettingsByAggID(ctx, authz.GetInstance(ctx).InstanceID())
|
2022-02-25 15:05:06 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return &admin_pb.GetOIDCSettingsResponse{
|
|
|
|
Settings: OIDCSettingsToPb(result),
|
|
|
|
}, nil
|
|
|
|
}
|
|
|
|
|
2022-09-27 10:53:49 +00:00
|
|
|
func (s *Server) AddOIDCSettings(ctx context.Context, req *admin_pb.AddOIDCSettingsRequest) (*admin_pb.AddOIDCSettingsResponse, error) {
|
|
|
|
result, err := s.command.AddOIDCSettings(ctx, AddOIDCConfigToConfig(req))
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return &admin_pb.AddOIDCSettingsResponse{
|
|
|
|
Details: object.DomainToChangeDetailsPb(result),
|
|
|
|
}, nil
|
|
|
|
}
|
|
|
|
|
2022-02-25 15:05:06 +00:00
|
|
|
func (s *Server) UpdateOIDCSettings(ctx context.Context, req *admin_pb.UpdateOIDCSettingsRequest) (*admin_pb.UpdateOIDCSettingsResponse, error) {
|
|
|
|
result, err := s.command.ChangeOIDCSettings(ctx, UpdateOIDCConfigToConfig(req))
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return &admin_pb.UpdateOIDCSettingsResponse{
|
|
|
|
Details: object.DomainToChangeDetailsPb(result),
|
|
|
|
}, nil
|
|
|
|
}
|