Skip to content

cheemx5395/auth-assignment-04

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Assignment – Service and Identity Provider Communication (Golang)

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.

Overview

  • 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.

Flow of Execution

  1. The IDP server is started and listens on localhost:8080.
  2. The Service connects to the IDP and displays a redirect message.
  3. The Service prompts the user for name and password.
  4. User credentials are sent to the IDP.
  5. 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
  6. 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

Project Structure

.
├── idp
│   └── main.go
├── service
│   └── main.go
├── Makefile
└── README.md

How to Run

Step 1: Start the Identity Provider

Open a terminal and run:

make idp

The IDP server will start listening on localhost:8080.

Step 2: Start the Service

Open another terminal and run:

make service

User Interaction

Service Prompts

  • Redirect message to Identity Provider
  • Enter user name
  • Enter password
  • Enter authentication token for verification

Token Verification Result

  • If the entered token matches the token generated by the IDP:

    Token Verified
    
  • If the token does not match:

    Invalid Token
    

Notes

  • 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.

Technologies Used

  • Golang
  • TCP networking (net package)
  • JSON encoding/decoding
  • In-memory data storage

About

Mock SSO flow with authorization code exchange

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors