Class JwtToken

java.lang.Object
io.jenkins.blueocean.auth.jwt.JwtToken
All Implemented Interfaces:
org.kohsuke.stapler.HttpResponse

public class JwtToken extends Object implements org.kohsuke.stapler.HttpResponse
Generates JWT token
Author:
Vivek Pandey
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    final net.sf.json.JSONObject
    JWT Claim
    final net.sf.json.JSONObject
    JWT header
    static final String
    JwtToken is sent as HTTP header of name.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    generateResponse(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp, Object node)
    Writes the token as an HTTP response.
    Generates base64 representation of JWT token sign using "RS256" algorithm getHeader().toBase64UrlEncode() + "." + getClaim().toBase64UrlEncode() + "." + sign

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • X_BLUEOCEAN_JWT

      public static final String X_BLUEOCEAN_JWT
      JwtToken is sent as HTTP header of name.
      See Also:
    • claim

      public final net.sf.json.JSONObject claim
      JWT Claim
  • Constructor Details

    • JwtToken

      public JwtToken()
  • Method Details

    • sign

      public String sign()
      Generates base64 representation of JWT token sign using "RS256" algorithm getHeader().toBase64UrlEncode() + "." + getClaim().toBase64UrlEncode() + "." + sign
      Returns:
      base64 representation of JWT token
    • generateResponse

      public void generateResponse(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp, Object node) throws IOException, javax.servlet.ServletException
      Writes the token as an HTTP response.
      Specified by:
      generateResponse in interface org.kohsuke.stapler.HttpResponse
      Throws:
      IOException
      javax.servlet.ServletException