0
# Authentication System
1
2
Complete authentication and authorization system for Panel applications, supporting OAuth providers, basic authentication, and custom login handlers. Essential for securing enterprise applications and controlling access to sensitive data and functionality.
3
4
## Capabilities
5
6
### OAuth Providers
7
8
Pre-built OAuth integration for popular identity providers, enabling secure single sign-on authentication flows.
9
10
```python { .api }
11
class GoogleLoginHandler:
12
"""Google OAuth login handler"""
13
14
class GitHubLoginHandler:
15
"""GitHub OAuth login handler"""
16
17
class AzureAdLoginHandler:
18
"""Azure Active Directory OAuth login handler"""
19
20
class AzureAdV2LoginHandler:
21
"""Azure Active Directory v2.0 OAuth login handler"""
22
23
class Auth0Handler:
24
"""Auth0 OAuth login handler"""
25
26
class GitLabLoginHandler:
27
"""GitLab OAuth login handler"""
28
29
class OktaLoginHandler:
30
"""Okta OAuth login handler"""
31
32
class BitbucketLoginHandler:
33
"""Bitbucket OAuth login handler"""
34
```
35
36
### Basic Authentication
37
38
Traditional username/password authentication with configurable user management.
39
40
```python { .api }
41
class BasicLoginHandler:
42
"""Basic username/password login handler"""
43
44
class PAMLoginHandler:
45
"""PAM (Pluggable Authentication Modules) login handler for system authentication"""
46
47
class PasswordLoginHandler:
48
"""Custom password authentication handler"""
49
```
50
51
### Authentication Providers
52
53
Base classes and providers for integrating authentication into Panel applications.
54
55
```python { .api }
56
class BasicAuthProvider:
57
"""Base authentication provider for Panel applications"""
58
59
class OAuthProvider:
60
"""OAuth-based authentication provider with customizable settings"""
61
```
62
63
### Generic Handlers
64
65
Flexible authentication handlers for custom authentication flows.
66
67
```python { .api }
68
class GenericLoginHandler:
69
"""Generic login handler for custom authentication implementations"""
70
71
class CodeChallengeLoginHandler:
72
"""PKCE (Proof Key for Code Exchange) authentication handler"""
73
74
class LogoutHandler:
75
"""Logout handler for terminating authenticated sessions"""
76
```
77
78
## Usage Example
79
80
```python
81
import panel as pn
82
83
# Configure OAuth authentication with Google
84
pn.config.oauth_provider = 'google'
85
pn.config.oauth_key = 'your-google-client-id'
86
pn.config.oauth_secret = 'your-google-client-secret'
87
88
# Create protected application
89
@pn.depends(pn.state.user_info)
90
def protected_app(user_info):
91
if not user_info:
92
return pn.pane.HTML("Please log in to access this application")
93
94
return pn.Column(
95
f"# Welcome, {user_info['login']}!",
96
"This is a protected application area"
97
)
98
99
protected_app().servable()
100
```