How mahaveer-rulaniya/authorization-and-security works
This is an Express/EJS secrets-sharing application. Users register or sign in locally or with Google, then authenticated users can submit a secret; visitors can view secrets shared by users. Passport manages authentication and sessions, while Mongoose stores user accounts and secrets in MongoDB. The graph follows the routes and database operations visible in app.js; the README describes additional encryption examples, but the active schema shown here does not enable the encryption plugin.
Main entry points: app.js Express routes · login.ejs Login page · secrets.ejs Secrets page · home.ejs Home page
Components 14
Web interface
- Express routes
app.js - Home page
views/home.ejs - Login page
views/login.ejs - Registration page
views/register.ejs - Submit page
views/submit.ejs - Secrets page
views/secrets.ejs
Authentication
- Passport auth
app.js - Session middleware
app.js - Google OAuth
app.js
User data
- User model
app.js - MongoDB
Secrets workflow
- Secret submission
app.js - Secret listing
app.js
Other components
- Visitor
Connections 22
- Visitor → Express routes: sends requests
app.js - Express routes → Home page: renders
app.js - Express routes → Login page: renders
app.js - Express routes → Registration page: renders
app.js - Express routes → Submit page: renders
app.js - Express routes → Secrets page: renders
app.js - Express routes → Session middleware: configures
app.js - Express routes → Passport auth: configures
app.js - Express routes → User model: defines
app.js - Express routes → Google OAuth: configures
app.js - Google OAuth → Visitor: redirects to
- Google OAuth → User model: finds or creates
app.js - Express routes → Passport auth: authenticates locally
app.js - Passport auth → User model: uses strategy
app.js - Express routes → User model: registers users
app.js - Express routes → Secret submission: handles submission
app.js - Secret submission → User model: loads and saves
app.js - Express routes → Secret listing: handles listing
app.js - Secret listing → User model: queries secrets
app.js - User model → MongoDB: persists users
app.js - Express routes → Login page: redirects unauthenticated users
app.js - Express routes → Secrets page: renders secret results
app.js