MCPcopy Index your code
hub / github.com/coder/coder / ApplyDefaults

Method ApplyDefaults

codersdk/oauth2.go:458–487  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

456}
457
458func (req OAuth2ClientRegistrationRequest) ApplyDefaults() OAuth2ClientRegistrationRequest {
459 // Apply grant type defaults.
460 if len(req.GrantTypes) == 0 {
461 req.GrantTypes = []OAuth2ProviderGrantType{
462 OAuth2ProviderGrantTypeAuthorizationCode,
463 OAuth2ProviderGrantTypeRefreshToken,
464 }
465 }
466
467 // Apply response type defaults.
468 if len(req.ResponseTypes) == 0 {
469 req.ResponseTypes = []OAuth2ProviderResponseType{
470 OAuth2ProviderResponseTypeCode,
471 }
472 }
473
474 // Apply token endpoint auth method default (RFC 7591 section 2).
475 if req.TokenEndpointAuthMethod == "" {
476 // Default according to RFC 7591: "client_secret_basic" for confidential clients.
477 // For public clients, should be explicitly set to "none".
478 req.TokenEndpointAuthMethod = OAuth2TokenEndpointAuthMethodClientSecretBasic
479 }
480
481 // Apply client name default if not provided.
482 if req.ClientName == "" {
483 req.ClientName = "Dynamically Registered Client"
484 }
485
486 return req
487}
488
489// DetermineClientType determines if client is public or confidential
490func (*OAuth2ClientRegistrationRequest) DetermineClientType() string {

Callers 2

Calls

no outgoing calls

Tested by

no test coverage detected