func (d *AdminAPIConnector) NewClient(meta oidc.ClientMetadata) (*oidc.ClientCredentials, error) { if err := meta.Valid(); err != nil { return nil, err } cli := client.Client{ Metadata: meta, } credential := &oidc.ClientCredentials{} service, err := adminschema.NewWithBasePath(d.client, d.baseURL) if err != nil { return credential, nil } urls := make([]string, len(cli.Metadata.RedirectURIs)) for i, url := range cli.Metadata.RedirectURIs { urls[i] = url.String() } c := &adminschema.Client{RedirectURIs: urls} createClientRequest := &adminschema.ClientCreateRequest{Client: c} response, err := service.Client.Create(createClientRequest).Do() if err != nil { return credential, err } credential.ID = response.Client.Id credential.Secret = response.Client.Secret return credential, nil }
func (d *dbConnector) NewClient(meta oidc.ClientMetadata) (*oidc.ClientCredentials, error) { if err := meta.Valid(); err != nil { return nil, err } cli := client.Client{ Metadata: meta, } return d.ciManager.New(cli, nil) }
func (d *dbDriver) NewClient(meta oidc.ClientMetadata) (*oidc.ClientCredentials, error) { if err := meta.Valid(); err != nil { return nil, err } clientID, err := oidc.GenClientID(meta.RedirectURLs[0].Host) if err != nil { return nil, err } return d.ciRepo.New(clientID, meta) }