def index(): remote_user = request.environ['REMOTE_USER'] keys = flask.g.store.listkeys(remote_user) # base64 encode the machine name keys = listkeys64(keys) env = { 'remote_user' : remote_user, 'sshkeys' : list(keys), 'enable_identities' : app.config['ENABLE_IDENTITIES'], 'home_url' : app.config['HOME_URL'], } return flask.render_template('index.jinja', **env)
def index(): remote_user = request.environ['REMOTE_USER'] keys = flask.g.store.listkeys(remote_user) # base64 encode the machine name keys = listkeys64(keys) env = { 'remote_user' : remote_user, 'sshkeys' : list(keys), 'enable_identities' : app.config['ENABLE_IDENTITIES'] } if app.config['ENABLE_IDENTITIES']: # this is where you could set the user's identity to a reasonable # default (from ldap for example) identity = flask.g.identities.get(remote_user) env['git_identity'] = identity and identity or '' return flask.render_template('index.jinja', **env)
def test_listkeys64(): keys = (('a', 'zxcv', 'asdf'),) for a, b, c in util.listkeys64(keys): assert util.urlsafe_b64decode(b) == keys[0][1]