pub enum CodexAuth {
ApiKey(ApiKeyAuth),
Chatgpt(ChatgptAuth),
ChatgptAuthTokens(ChatgptAuthTokens),
Headers(AuthHeaders),
AgentIdentity(AgentIdentityAuth),
PersonalAccessToken(PersonalAccessTokenAuth),
BedrockApiKey(BedrockApiKeyAuth),
}Expand description
Authentication mechanism used by the current user.
Variants§
ApiKey(ApiKeyAuth)
Chatgpt(ChatgptAuth)
ChatgptAuthTokens(ChatgptAuthTokens)
Headers(AuthHeaders)
AgentIdentity(AgentIdentityAuth)
PersonalAccessToken(PersonalAccessTokenAuth)
BedrockApiKey(BedrockApiKeyAuth)
Implementations§
Source§impl CodexAuth
impl CodexAuth
pub async fn from_auth_storage( codex_home: &Path, auth_credentials_store_mode: AuthCredentialsStoreMode, chatgpt_base_url: Option<&str>, keyring_backend_kind: AuthKeyringBackendKind, auth_route_config: Option<&AuthRouteConfig>, ) -> Result<Option<Self>>
pub async fn from_agent_identity_jwt( jwt: &str, chatgpt_base_url: Option<&str>, auth_route_config: Option<&AuthRouteConfig>, ) -> Result<Self>
pub async fn from_personal_access_token( access_token: &str, auth_route_config: Option<&AuthRouteConfig>, ) -> Result<Self>
Sourcepub fn auth_mode(&self) -> AuthMode
pub fn auth_mode(&self) -> AuthMode
Returns the effective backend auth mode.
Externally managed ChatGPT tokens are normalized to AuthMode::Chatgpt.
Sourcepub fn api_auth_mode(&self) -> AuthMode
pub fn api_auth_mode(&self) -> AuthMode
Returns the precise kind of credentials backing this authentication.
pub fn is_api_key_auth(&self) -> bool
pub fn is_personal_access_token_auth(&self) -> bool
pub fn is_chatgpt_auth(&self) -> bool
pub fn uses_codex_backend(&self) -> bool
pub fn is_external_chatgpt_tokens(&self) -> bool
Sourcepub fn get_token_data(&self) -> Result<TokenData, Error>
pub fn get_token_data(&self) -> Result<TokenData, Error>
Returns Err if token-backed ChatGPT auth is unavailable.
Sourcepub fn get_token(&self) -> Result<String, Error>
pub fn get_token(&self) -> Result<String, Error>
Returns the token string used for bearer authentication.
Sourcepub fn get_account_id(&self) -> Option<String>
pub fn get_account_id(&self) -> Option<String>
Returns None if Codex backend auth does not expose an account id.
Sourcepub fn is_fedramp_account(&self) -> bool
pub fn is_fedramp_account(&self) -> bool
Returns false if Codex backend auth omits the FedRAMP claim.
Sourcepub fn get_account_email(&self) -> Option<String>
pub fn get_account_email(&self) -> Option<String>
Returns None if Codex backend auth does not expose an account email.
Sourcepub fn get_chatgpt_user_id(&self) -> Option<String>
pub fn get_chatgpt_user_id(&self) -> Option<String>
Returns None if Codex backend auth does not expose a ChatGPT user id.
Sourcepub fn account_plan_type(&self) -> Option<AccountPlanType>
pub fn account_plan_type(&self) -> Option<AccountPlanType>
Account-facing plan classification derived from the current auth.
Returns a high-level AccountPlanType (e.g., Free/Plus/Pro/Team/…)
for UI or product decisions based on the user’s subscription.
pub fn is_workspace_account(&self) -> bool
Sourcepub fn create_dummy_chatgpt_auth_for_testing() -> Self
pub fn create_dummy_chatgpt_auth_for_testing() -> Self
Consider this private to integration tests.
Sourcepub fn from_external_chatgpt_tokens(
access_token: &str,
chatgpt_account_id: &str,
chatgpt_plan_type: Option<&str>,
) -> Result<Self>
pub fn from_external_chatgpt_tokens( access_token: &str, chatgpt_account_id: &str, chatgpt_plan_type: Option<&str>, ) -> Result<Self>
Constructs in-memory ChatGPT auth from externally managed tokens.
pub fn from_api_key(api_key: &str) -> Self
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for CodexAuth
impl !UnwindSafe for CodexAuth
impl Freeze for CodexAuth
impl Send for CodexAuth
impl Sync for CodexAuth
impl Unpin for CodexAuth
impl UnsafeUnpin for CodexAuth
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<T> AsTypeStaticRegistered for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
impl<T> HasTyVTable for Twhere
T: ?Sized,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request