Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [Python] Uwierzytelnienie klienta
rafakl
post
Post #1





Grupa: Zarejestrowani
Postów: 33
Pomógł: 0
Dołączył: 4.02.2013

Ostrzeżenie: (0%)
-----


Witam,

Mam do Was dużą prośbę. Napisałem już architekturę klient/serwer i potrzebuję do tego zaprogramować mocne uwierzytelnienie (wszystko w pythonie).
To moje pierwsze kroki w tym języki programowania a język narzucony odgórnie.

Pozdrowienia!
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 4)
pedro84
post
Post #2





Grupa: Nieautoryzowani
Postów: 2 249
Pomógł: 305
Dołączył: 2.10.2006

Ostrzeżenie: (0%)
-----


Rozumiem, że masz jakieś pytanie, tylko dlaczego jest ono takie tajemnicze?


--------------------
Google knows the answer...
Go to the top of the page
+Quote Post
rafakl
post
Post #3





Grupa: Zarejestrowani
Postów: 33
Pomógł: 0
Dołączył: 4.02.2013

Ostrzeżenie: (0%)
-----


Hej pedro

Heh faktycznie czegoś zapomnialem tongue.gif To z pośpiechu.
Chodzi mi o pomoc w rozwiązaniu problemu uwierzytelnienia napisanego w pythonie, jakieś tutoriale, manuale bądź cokolwiek (może ktoś już takie coś robił i się podzieli). Buszuję po sieci ale jak narazie nic się nie nadaje.
Go to the top of the page
+Quote Post
pedro84
post
Post #4





Grupa: Nieautoryzowani
Postów: 2 249
Pomógł: 305
Dołączył: 2.10.2006

Ostrzeżenie: (0%)
-----


Nie robiłem jeszcze w Pythonie czegoś podobnego, ale coś doradzić spróbuję wink.gif Rzuć okiem na bibliotekę Twisted, jest bardzo przyjemna, w sekcji Examples masz ciekawe przykłady (w tym webguard.py pokazujący właśnie to co chcesz).

A może napisz konkretnie co masz, co robisz, może wtedy coś innego się doradzi.


--------------------
Google knows the answer...
Go to the top of the page
+Quote Post
rafakl
post
Post #5





Grupa: Zarejestrowani
Postów: 33
Pomógł: 0
Dołączył: 4.02.2013

Ostrzeżenie: (0%)
-----


Bardzo dziękuję za zainteresowanie tematem smile.gif

Mam serwer (z dokumentacji)
Cytat
import SocketServer

class MyTCPHandler(SocketServer.BaseRequestHandler):
"""
The RequestHandler class for our server.

It is instantiated once per connection to the server, and must
override the handle() method to implement communication to the
client.
"""

def handle(self):
# self.request is the TCP socket connected to the client
self.data = self.request.recv(1024).strip()
print "{} wrote:".format(self.client_address[0])
print self.data
# just send back the same data, but upper-cased
self.request.sendall(self.data.upper())

if __name__ == "__main__":
HOST, PORT = "localhost", 9999

# Create the server, binding to localhost on port 9999
server = SocketServer.TCPServer((HOST, PORT), MyTCPHandler)

# Activate the server; this will keep running until you
# interrupt the program with Ctrl-C
server.serve_forever()


Oraz klienta

Cytat
import socket
import sys

HOST, PORT = "localhost", 9999
data = " ".join(sys.argv[1:])

# Create a socket (SOCK_STREAM means a TCP socket)
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

try:
# Connect to server and send data
sock.connect((HOST, PORT))
sock.sendall(data + "\n")

# Receive data from the server and shut down
received = sock.recv(1024)
finally:
sock.close()

print "Sent: {}".format(data)
print "Received: {}".format(received)


Musze zrobić jeszcze uwierzytelnienie klienta przez hasło, który będzie miał dostęp do jakiejś sesji/zasobów oraz serwer musi trzymać hasze haseł.
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 22.08.2025 - 00:06