auth_pubtkt

Software screenshot:
auth_pubtkt
Dettagli del software:
Versione: 0.1
Data di caricamento: 12 May 15
Sviluppatore: Andrey Plotnikov
Licenza: Libero
Popolarità: 12

Rating: 3.0/5 (Total Votes: 1)

auth_pubtkt è un modulo che implementa l'autenticazione mod_auth_pubtkt per Python mondo.
creazione biglietteria
Importazione moduli nessesary:
& Nbsp; >>> da M2Crypto importazione RSA
& Nbsp; >>> auth_pubtkt importazione
& Nbsp; >>> auth_pubtkt.tests importazione
& Nbsp; >>> os.path import
& Nbsp; >>> momento dell'importazione, datetime
Caricamento RSA chiave privata dalla confezione prove:
& Nbsp; >>> privkey_path = os.path.join (os.path.dirname (auth_pubtkt.tests .__ FILE__), 'rsa_priv.pem')
& Nbsp; >>> privkey = RSA.load_key (privkey_path)
Impostare il tempo di scadenza per 2011/01/01 00:00
& Nbsp; >>> validuntil = int (time.mktime (datetime.datetime (2011, 1, 1) .timetuple ()))
Generazione di biglietto per l'utente 'john':
& Nbsp; >>> biglietto = auth_pubtkt.create_ticket (privkey, 'John', validuntil, tokens = ['do'])
& Nbsp; >>> biglietto
 'uid=john;validuntil=1293814800;tokens=su;sig=YuM/RL8ub+XMb0ZTTlFYF6ehwRV8SnKx+TLj/syZmVx1ncR4QD58OMdRkmdmDCY9sdsoivcf+ACRCRX19nmEc5Ba+182FyRKC8bGL51GwPs+lMgaIaXxvhSvRbl/00sTWny+XEv1fEQDSc5tw3/ug6/YA9xt2wywUX1+hxfWQ5U='
Middleware
& Nbsp; >>> urllib importazione
& Nbsp; >>> pubkey_path = os.path.join (os.path.dirname (auth_pubtkt.tests .__ FILE__), 'rsa_pub.pem')
& Nbsp; >>> pubkey = RSA.load_pub_key (pubkey_path)
& Nbsp; >>> def test_app (environ, start_response):
& Nbsp; ... per la chiave in ordinate (environ.keys ()):
& Nbsp; ... print '% s:% s'% (chiave, environ [tasto])
& Nbsp; >>> app = auth_pubtkt.AuthPubTKTMiddleware (test_app, pubkey)
& Nbsp; >>> env = {}
& Nbsp; >>> env ['REMOTE_ADDR'] = '192.168.1.10'
& Nbsp; >>> env ['REQUEST_METHOD'] = 'GET'
& Nbsp; >>> env ['HTTP_COOKIE'] 'auth_pubtkt = "% s"' =% urllib.quote (ticket)
& Nbsp; >>> app (env, stato lambda, iniziare: Nessuno)
& Nbsp; AUTH_TYPE: biscotto
& Nbsp; HTTP_COOKIE: auth_pubtkt="uid=john;validuntil=1293814800;tokens=su;sig=YuM/RL8ub+XMb0ZTTlFYF6ehwRV8SnKx+TLj/syZmVx1ncR4QD58OMdRkmdmDCY9sdsoivcf+ACRCRX19nmEc5Ba+182FyRKC8bGL51GwPs+lMgaIaXxvhSvRbl/00sTWny+XEv1fEQDSc5tw3/ug6/YA9xt2wywUX1+hxfWQ5U="
& Nbsp; REMOTE_ADDR: 192.168.1.10
& Nbsp; REMOTE_USER: john
& Nbsp; REMOTE_USER_DATA:
& Nbsp; REMOTE_USER_TOKENS: su
& Nbsp; REMOTE_USER_TOKENS_LIST: ['do']
& Nbsp; REQUEST_METHOD: GET
& nbsp; auth_pubtkt.ticket_fields: {"gettoni": ['su'], 'validuntil': 1293814800, 'uid': 'john'}

Requisiti :

  • Python

Commenti a auth_pubtkt

I commenti non trovato
Aggiungi commento
Accendere le immagini!