7 releases (breaking)
Uses new Rust 2024
| 0.6.0 | Mar 5, 2026 |
|---|---|
| 0.5.1 | Feb 16, 2026 |
| 0.4.0 | Feb 7, 2026 |
| 0.3.0 | Feb 6, 2026 |
| 0.1.0 | Jan 2, 2026 |
#1459 in Authentication
Used in 3 crates
(2 directly)
195KB
4K
SLoC
corevpn-auth
Authentication and authorization for CoreVPN - OAuth2, OIDC, and SAML support.
Features
- OAuth2/OIDC: Integration with identity providers
- SAML 2.0: Enterprise SSO support
- Certificate Auth: X.509 client certificate authentication
- Token Management: Secure token storage and refresh
- Provider Support: Google, Microsoft, Okta, and generic OIDC
Supported Providers
| Provider | Type | Features |
|---|---|---|
| OIDC | Domain restriction, group claims | |
| Microsoft | OIDC | Azure AD, tenant restriction |
| Okta | OIDC | Group-based access control |
| Generic | OIDC | Any OIDC-compliant IdP |
| SAML | SAML 2.0 | Enterprise IdP integration |
Usage
use corevpn_auth::{OAuthProvider, OAuthConfig};
// Configure Google OAuth
let config = OAuthConfig::google(
"client_id",
"client_secret",
vec!["example.com".to_string()], // allowed domains
);
// Create provider
let provider = OAuthProvider::new(config).await?;
// Get authorization URL
let (auth_url, state) = provider.authorization_url()?;
// Exchange code for tokens
let tokens = provider.exchange_code(code, state).await?;
License
Licensed under either of:
- Apache License, Version 2.0 (LICENSE-APACHE)
- MIT license (LICENSE-MIT)
at your option.
Dependencies
~33–53MB
~1M SLoC