Movatterモバイル変換


[0]ホーム

URL:


aibridgedserver

package
v2.28.5Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 1, 2025 License:AGPL-3.0Imports:22Imported by:0

Details

Repository

github.com/coder/coder

Links

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (ErrExpiredOrInvalidOAuthToken =xerrors.New("expired or invalid OAuth2 token")ErrNoMCPConfigFound           =xerrors.New("no MCP config found")// These errors are returned by IsAuthorized. Since they're just returned as// a generic dRPC error, it's difficult to tell them apart without string// matching.// TODO: return these errors to the client in a more structured/comparable//       way.ErrInvalidKey  =xerrors.New("invalid key")ErrUnknownKey  =xerrors.New("unknown key")ErrExpired     =xerrors.New("expired")ErrUnknownUser =xerrors.New("unknown user")ErrDeletedUser =xerrors.New("deleted user")ErrSystemUser  =xerrors.New("system user")ErrNoExternalAuthLinkFound =xerrors.New("no external auth link found"))

Functions

This section is empty.

Types

typeServer

type Server struct {// contains filtered or unexported fields}

funcNewServer

func NewServer(lifecycleCtxcontext.Context, store store, loggerslog.Logger, accessURLstring, externalAuthConfigs []*externalauth.Config, experimentscodersdk.Experiments) (*Server,error)

func (*Server)IsAuthorized

IsAuthorized validates a given Coder API key and returns the user ID to which it belongs (if valid).

NOTE: this should really be using the code fromhttpmw.ExtractAPIKey. That function not only validates the keybut handles many other cases like updating last used, expiry, etc. This code does not currently use it fora few reasons:

  1. httpmw.ExtractAPIKey relies on keys being given in specific headershttpmw.APITokenFromRequest which AIbridge requests will not conform to.
  2. The code mixes many different concerns, and handles HTTP responses too, which is undesirable here.
  3. The core logic would need to be extracted, but that will surely be a complex & time-consuming distraction right now.
  4. Once we have an Early Access release of AI Bridge, we need to return to this.

TODO: replace with logic fromhttpmw.ExtractAPIKey.

Source Files

View all Source files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp