I ran across this problem on a project and I thought I’d share some sample code to get you going. As far as passing the generated jwt you can do it as a header Authorization parameter. A good tool for trying this out is postman which you can download with the link below. In a later blog I’ll share with you a simple way to pass the jwt to any soap or rest web service.
import com.auth0.jwt.JWT;
import com.auth0.jwt.algorithms.Algorithm;
import java.util.Date;
// Set the JWT claims
String subject = “user@example.com”;
String issuer = “https://example.com”;
Date now = new Date();
Date expiration = new Date(now.getTime() + 3600); // expires in 1 hour
// Set the algorithm and key for signing the JWT
Algorithm algorithm = Algorithm.HMAC256(“secret”);
// Create the JWT
String token = JWT.create()
.withSubject(subject)
.withIssuer(issuer)
.withIssuedAt(now)
.withExpiresAt(expiration)
.sign(algorithm);
// The token is now ready to be transmitted to the client