Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added authentication to spyre #87

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

Dana-Farber
Copy link

@Dana-Farber Dana-Farber commented Feb 7, 2018

The following is a working example

from spyre import server

class SimpleApp(server.App):
	title = "Simple App"
	inputs = [{
		"type": "text",
		"key": "words",
		"label": "write words here",
		"value": "hello world",
		"action_id": "simple_html_output"
	}]

	outputs = [{
		"type": "html",
		"id": "simple_html_output"
	}]

	def getHTML(self, params):
		words = params["words"]
		return "Here's what you wrote in the textbox: <b>%s</b>" % words

USERS={"alice":"secret"}

from cherrypy.lib import auth_digest #must import this to compute ha1 digest
digest_auth = {'/': {'tools.auth_digest.on': True,
               'tools.auth_digest.realm': 'wonderland',
               'tools.auth_digest.get_ha1': auth_digest.get_ha1_dict_plain(USERS),
               'tools.auth_digest.key': 'a565c27146791cfb',
}}

app = SimpleApp()
app.launch(config=digest_auth)

@Dana-Farber Dana-Farber mentioned this pull request Feb 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant