Khan / Khan/snippets

Locking down access to your domain

Open
#34 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
215
Forks
32
PR merge metrics
No merged PRs in 30d

Description

The new flex environment let's you restrict authentication to users within your domain, but it's now clear how that should work for apps like this that runs on the older version of App Engine, so I aded a few lines just inside `SummaryPage` and `UserPage`
```py
user_email = self.request.get('u', _current_user_email())

# Reject all but domain users
user_domain = user_email.split('@')[-1]
app_settings = models.AppSettings.get()
if user_domain not in app_settings.domains:
self.redirect(users.create_logout_url('/'))
return
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating the SummaryPage and UserPage handlers and reading how the current user and AppSettings.domains are used. Confirm the expected behavior for users outside the configured domains, including logout and redirect, and verify that both handlers apply the same restriction.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
authentication, authorization
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.