Skip to content

Instantly share code, notes, and snippets.

@magmastonealex
Created December 11, 2013 03:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save magmastonealex/7904565 to your computer and use it in GitHub Desktop.
Save magmastonealex/7904565 to your computer and use it in GitHub Desktop.
from openid.store import filestore
from openid.consumer import consumer
from lib.persistDict import getDict
from lib.login import *
import sha
import web
class openid_fin:
def GET(self):
dicti = {}
dicti = getDict()
#return "ERR."
print "------------------------"
print dicti
oidconsumer = consumer.Consumer(dicti, filestore.FileOpenIDStore("nonce"))
cons = oidconsumer.complete(web.input(), web.ctx.homedomain+"/openid_fin")
# print con
if cons.status == consumer.SUCCESS:
shah = sha.new(cons.getDisplayIdentifier())
shah = shah.hexdigest()
testtok = web.cookies(token="blank")["token"]
#print "TOK:::::"+testtok
tok = get_token(shah)
if tok != False:
#print "Issuing token & logging in."
web.setcookie("token", tok)
web.setcookie("uniqid", shah)
login(shah, tok)
#print "Done."
web.found("/")
elif cons.status == consumer.FAILURE:
return "Hax."
elif cons.status == consumer.CANCEL:
web.found("/")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment