making / demo-rsocket-security

Demo RSocket + Spring Security

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

./mvnw clean package -DskipTests

Install rsc 0.7.0+ .

Simple Authentication

java -jar target/demo-rsocket-security-0.0.1-SNAPSHOT.jar

Authentication per stream

$ rsc tcp://localhost:8888 --authSimple user:password -r hello -d World
Hello World, user!

# or

$ rsc tcp://localhost:8888 -u user:password -r hello -d World
Hello World, user!

Authentication per connection

$ rsc tcp://localhost:8888 --sm simple:user:password --smmt message/x.rsocket.authentication.v0 -r hello -d World
Hello World, user!

# or

$ rsc tcp://localhost:8888 --sm simple:user:password --smmt MESSAGE_RSOCKET_AUTHENTICATION -r hello -d World
Hello World, user!

Bearer Authentication

This demo app uses Pivotal Web Services as an Authentication Server.

Create a PWS account.

java -jar target/demo-rsocket-security-0.0.1-SNAPSHOT.jar --spring.profiles.active=bearer

Retrieve token using cf CLI.

cf api api.run.pivotal.io
cf auth <USERNAME> <PASSWORD>
TOKEN=$(cf oauth-token | sed 's/^bearer //')

Authentication per stream

$ rsc tcp://localhost:8888 --authBearer ${TOKEN} -r hello -d World
Hello World, <USERNAME>!

Authentication per connection

$ rsc tcp://localhost:8888 --sm bearer:${TOKEN} --smmt message/x.rsocket.authentication.v0 -r hello -d World
Hello World, <USERNAME>!

# or

$ rsc tcp://localhost:8888 --sm bearer:${TOKEN} --smmt MESSAGE_RSOCKET_AUTHENTICATION -r hello -d World
Hello World, <USERNAME>!

(Legacy) Basic Authentication

java -jar target/demo-rsocket-security-0.0.1-SNAPSHOT.jar --spring.profiles.active=legacy

Authentication per stream

$ rsc tcp://localhost:8888 --authBasic user:password -r hello -d World
Hello World, user!

Authentication per connection

$ rsc tcp://localhost:8888 --sm user:password --smmt message/x.rsocket.authentication.basic.v0 -r hello -d World
Hello World, user!

# or

$ rsc tcp://localhost:8888 --sm user:password --smmt AUTHENTICATION_BASIC -r hello -d World
Hello World, user!

About

Demo RSocket + Spring Security


Languages

Language:Java 100.0%