Your OAuth 2.1 Authorization Server is now fully functional and running on http://localhost:9000
OAuth 2.1 Compliance
Grant Types Supported
OpenID Connect 1.0
Security Features
Auth201Server/ ├── src/main/java/com/heaerie/server/auth201/Auth201Server/ │ ├── Auth201ServerApplication.java # Main application │ ├── config/ │ │ └── SecurityConfig.java # OAuth 2.1 security configuration │ └── controller/ │ └── UserController.java # Protected resources ├── src/main/resources/ │ └── application.yaml # Configuration ├── pom.xml # Maven dependencies ├── README.md # Complete documentation ├── EXAMPLES.md # Code examples and integrations ├── postman_collection.json # Postman test collection └── test-oauth.sh # Bash test script
Client ID: public-client Client Secret: None (public client) PKCE: Required Grant Types: Authorization Code, Refresh Token Redirect URIs: - http://127.0.0.1:8080/authorized - http://127.0.0.1:8080/login/oauth2/code/public-client Scopes: openid, profile, email, read, write
Client ID: confidential-client Client Secret: secret PKCE: Required (recommended) Grant Types: Authorization Code, Refresh Token, Client Credentials Redirect URIs: - http://127.0.0.1:8080/authorized - http://127.0.0.1:8080/login/oauth2/code/confidential-client Scopes: openid, profile, email, read, write
| Username | Password | Roles |
|---|---|---|
| user | password | USER |
| admin | admin | USER, ADMIN |
| Endpoint | URL | Description |
|---|---|---|
| Home | http://localhost:9000/ | Server status |
| Well-Known | http://localhost:9000/.well-known/oauth-authorization-server | OAuth configuration |
| Authorization | http://localhost:9000/oauth2/authorize | Start OAuth flow |
| Token | http://localhost:9000/oauth2/token | Exchange codes/refresh tokens |
| JWK Set | http://localhost:9000/oauth2/jwks | Public keys for JWT verification |
| UserInfo | http://localhost:9000/userinfo | User information (requires token) |
| Token Introspection | http://localhost:9000/oauth2/introspect | Validate tokens |
| Token Revocation | http://localhost:9000/oauth2/revoke | Revoke tokens |
| H2 Console | http://localhost:9000/h2-console | Database console (dev only) |
cd /Users/agalyaramadoss/Downloads/Auth201Server ./mvnw spring-boot:run
Server will start on: http://localhost:9000
./test-oauth.sh
Import postman_collection.json into Postman and test all flows.
# Generate PKCE CODE_VERIFIER=$(openssl rand -base64 32 | tr -d '+/' | tr '=' '_' | cut -c1-43) CODE_CHALLENGE=$(echo -n "$CODE_VERIFIER" | openssl dgst -binary -sha256 | openssl base64 | tr -d '+/' | tr '=' '_') # Open in browser open "http://localhost:9000/oauth2/authorize?response_type=code&client_id=public-client&redirect_uri=http://127.0.0.1:8080/authorized&scope=openid%20profile%20read&code_challenge=$CODE_CHALLENGE&code_challenge_method=S256&state=xyz" # After login (user/password), exchange code for tokens curl -X POST http://localhost:9000/oauth2/token \ -H "Content-Type: application/x-www-form-urlencoded" \ -d "grant_type=authorization_code" \ -d "code=YOUR_CODE" \ -d "redirect_uri=http://127.0.0.1:8080/authorized" \ -d "client_id=public-client" \ -d "code_verifier=$CODE_VERIFIER"
curl -X POST http://localhost:9000/oauth2/token \ -u confidential-client:secret \ -d "grant_type=client_credentials" \ -d "scope=read write"
Production Deployment
Customization
SecurityConfig.javaIntegration
- spring-boot-starter-web - spring-boot-starter-security - spring-security-oauth2-authorization-server - spring-boot-starter-data-jpa - h2database (runtime) - commons-logging
server.port: 9000 database: H2 in-memory logging: DEBUG for security
Server won't start?
# Check if port 9000 is available lsof -i :9000 # Kill existing process kill -9 <PID> # Rebuild ./mvnw clean install
Build errors?
# Update dependencies ./mvnw clean install -U # Check Java version java -version # Should be 21+
You now have a fully functional OAuth 2.1 Authorization Server with:
The server is ready to use for development and can be deployed to production with proper configuration! 🎉