Skip to content

Commit 62ce397

Browse files
authored
docs(security): remove redundant examples, point toward other docs page instead
These were getting stale and not being updated with the newer examples on the Security page. More DRY and maintainable to have them all in a single place.
1 parent e93b540 commit 62ce397

File tree

1 file changed

+7
-104
lines changed

1 file changed

+7
-104
lines changed

examples/oauth/config.py

Lines changed: 7 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -34,110 +34,13 @@
3434
# AUTH_REMOTE_USER : Is for using REMOTE_USER from web server
3535
AUTH_TYPE = AUTH_OAUTH
3636

37-
OAUTH_PROVIDERS = [
38-
{
39-
"name": "twitter",
40-
"icon": "fa-twitter",
41-
"remote_app": {
42-
"client_id": os.environ.get("TWITTER_KEY"),
43-
"client_secret": os.environ.get("TWITTER_SECRET"),
44-
"api_base_url": "https://api.twitter.com/1.1/",
45-
"request_token_url": "https://api.twitter.com/oauth/request_token",
46-
"access_token_url": "https://api.twitter.com/oauth/access_token",
47-
"authorize_url": "https://api.twitter.com/oauth/authenticate",
48-
"fetch_token": lambda: session.get(
49-
"oauth_token"
50-
), # DON'T DO THIS IN PRODUCTION
51-
},
52-
},
53-
{
54-
"name": "google",
55-
"icon": "fa-google",
56-
"token_key": "access_token",
57-
"remote_app": {
58-
"client_id": os.environ.get("GOOGLE_KEY"),
59-
"client_secret": os.environ.get("GOOGLE_SECRET"),
60-
"api_base_url": "https://www.googleapis.com/oauth2/v2/",
61-
"client_kwargs": {"scope": "email profile"},
62-
"request_token_url": None,
63-
"access_token_url": "https://accounts.google.com/o/oauth2/token",
64-
"authorize_url": "https://accounts.google.com/o/oauth2/auth",
65-
"jwks_uri": "https://www.googleapis.com/oauth2/v3/certs",
66-
},
67-
},
68-
{
69-
"name": "azure",
70-
"icon": "fa-windows",
71-
"token_key": "access_token",
72-
"remote_app": {
73-
"client_id": os.environ.get("AZURE_APPLICATION_ID"),
74-
"client_secret": os.environ.get("AZURE_SECRET"),
75-
"api_base_url": f"https://login.microsoftonline.com/{os.environ.get('AZURE_TENANT_ID')}/oauth2",
76-
"client_kwargs": {
77-
"scope": "User.read name preferred_username email profile upn",
78-
"resource": os.environ.get("AZURE_APPLICATION_ID"),
79-
},
80-
"request_token_url": None,
81-
"access_token_url": f"https://login.microsoftonline.com/"
82-
f"{os.environ.get('AZURE_TENANT_ID')}/"
83-
"oauth2/token",
84-
"authorize_url": f"https://login.microsoftonline.com/"
85-
f"{os.environ.get('AZURE_TENANT_ID')}/"
86-
f"oauth2/authorize",
87-
},
88-
},
89-
{
90-
"name": "okta",
91-
"icon": "fa-circle-o",
92-
"token_key": "access_token",
93-
"remote_app": {
94-
"client_id": os.environ.get("OKTA_KEY"),
95-
"client_secret": os.environ.get("OKTA_SECRET"),
96-
"api_base_url": f"https://{os.environ.get('OKTA_DOMAIN')}.okta.com/oauth2/v1/",
97-
"client_kwargs": {"scope": "openid profile email groups"},
98-
"access_token_url": f"https://{os.environ.get('OKTA_DOMAIN')}.okta.com/"
99-
f"oauth2/v1/token",
100-
"authorize_url": f"https://{os.environ.get('OKTA_DOMAIN')}.okta.com/"
101-
f"oauth2/v1/authorize",
102-
"server_metadata_url": f"https://{os.environ.get('OKTA_DOMAIN')}.okta.com/"
103-
f".well-known/openid-configuration",
104-
},
105-
},
106-
{
107-
"name": "keycloak",
108-
"icon": "fa-key",
109-
"token_key": "access_token",
110-
"remote_app": {
111-
"client_id": os.environ.get("KEYCLOAK_CLIENT_ID"),
112-
"client_secret": os.environ.get("KEYCLOAK_CLIENT_SECRET"),
113-
"api_base_url": f"https://{os.environ.get('KEYCLOAK_DOMAIN')}/"
114-
f"realms/master/protocol/openid-connect",
115-
"client_kwargs": {"scope": "email profile"},
116-
"access_token_url": f"https://{os.environ.get('KEYCLOAK_DOMAIN')}/"
117-
f"realms/master/protocol/openid-connect/token",
118-
"authorize_url": f"https://{os.environ.get('KEYCLOAK_DOMAIN')}/"
119-
f"realms/master/protocol/openid-connect/auth",
120-
"request_token_url": None,
121-
},
122-
},
123-
{
124-
"name": "keycloak_before_17",
125-
"icon": "fa-key",
126-
"token_key": "access_token",
127-
"remote_app": {
128-
"client_id": os.environ.get("KEYCLOAK_CLIENT_ID"),
129-
"client_secret": os.environ.get("KEYCLOAK_CLIENT_SECRET"),
130-
"api_base_url": f"https://{os.environ.get('KEYCLOAK_DOMAIN')}/"
131-
f"auth/realms/master/protocol/openid-connect",
132-
"client_kwargs": {"scope": "email profile"},
133-
"access_token_url": f"https://{os.environ.get('KEYCLOAK_DOMAIN')}/"
134-
f"auth/realms/master/protocol/openid-connect/token",
135-
"authorize_url": f"https://{os.environ.get('KEYCLOAK_DOMAIN')}/"
136-
f"auth/realms/master/protocol/openid-connect/auth",
137-
"request_token_url": None,
138-
},
139-
},
140-
]
37+
# Uncomment and add provider(s). See templates on the Security documentation page
38+
# OAUTH_PROVIDERS = [
39+
# {
40+
# "name": "...",
41+
# ...
42+
# },
43+
#]
14144

14245
# Uncomment to setup Full admin role name
14346
# AUTH_ROLE_ADMIN = 'Admin'

0 commit comments

Comments
 (0)