This assignment demonstrates inter-process communication between a Service and an Identity Provider (IDP) using TCP sockets in Golang.
It simulates a basic authentication flow including user registration, token generation, and token verification.
- The IDP acts as an authentication authority.
- The Service acts as a client requesting authentication.
- Communication is done over TCP using JSON messages.
- User data and tokens are stored in memory for the duration of the program execution.
- The IDP server is started and listens on
localhost:8080. - The Service connects to the IDP and displays a redirect message.
- The Service prompts the user for name and password.
- User credentials are sent to the IDP.
- The IDP:
- Stores the user in memory
- Generates an authentication token
- Sends the token back to the Service
- Prints the generated token on the console
- The Service:
- Receives the token
- Displays it to the user
- Prompts the user to re-enter the token
- Verifies the token and prints the result
.
├── idp
│ └── main.go
├── service
│ └── main.go
├── Makefile
└── README.md
Open a terminal and run:
make idpThe IDP server will start listening on localhost:8080.
Open another terminal and run:
make service- Redirect message to Identity Provider
- Enter user name
- Enter password
- Enter authentication token for verification
-
If the entered token matches the token generated by the IDP:
Token Verified -
If the token does not match:
Invalid Token
- User data and authentication tokens are stored in memory and reset when the programs stop.
- This implementation is a mock authentication system intended for learning purposes.
- No persistent storage or encryption mechanisms are used beyond token generation.
- Golang
- TCP networking (
netpackage) - JSON encoding/decoding
- In-memory data storage