Tabnine Logo
SimpleJwtParser.<init>
Code IndexAdd Tabnine to your IDE (free)

How to use
com.atlassian.jwt.core.SimpleJwtParser
constructor

Best Java code snippets using com.atlassian.jwt.core.SimpleJwtParser.<init> (Showing top 2 results out of 315)

origin: com.atlassian.plugins/atlassian-connect-test-support-plugin

@Override
protected boolean shouldProcess(HttpServletRequest request) {
  String jwtToken = JwtUtil.extractJwt(request);
  if (!StringUtils.isEmpty(jwtToken)) {
    try {
      Jwt jwt = new SimpleJwtParser().parse(jwtToken);
      boolean wasIssuedByHost = jwtWasIssuedByHost(jwt.getIssuer());
      log.debug("wasIssuedByHost={}", wasIssuedByHost);
      return wasIssuedByHost;
    } catch (Exception e) {
      // one of the many possible JWT reading exceptions was thrown - log for debugging and let the invoking test fail
      log.error(String.format("Failed to read JWT token '%s' due to exception: ", jwtToken), e);
    }
  }
  log.debug("JWT token was empty: should not process request");
  return false;
}
origin: com.atlassian.connect/ac-spring-boot-autoconfigure

  @Override
  public Authentication authenticate(Authentication authentication) throws AuthenticationException {
    final Jwt unvalidatedJwt;
    try {
      unvalidatedJwt = new SimpleJwtParser().parse(authentication.getCredentials().toString());
    } catch (JwtParseException e) {
      throw new BadCredentialsException("Invalid JWT", e);
    }

    final TenantContext tenantContext = clientRegistry.get(unvalidatedJwt.getIssuer()).get();
    final String rawJwt = (String) authentication.getCredentials();

    NimbusMacJwtReader reader = new NimbusMacJwtReader(tenantContext.getSharedSecret());
    try {
      final com.atlassian.jwt.Jwt verifiedJwt = reader.readAndVerify(rawJwt, Collections.<String, JwtClaimVerifier>emptyMap());
      final TenantRequestContext tenantRequestContext = TenantRequestContext.initialise(tenantContext, verifiedJwt);
      final JwtAuthentication jwtAuthentication = new JwtAuthentication(authentication.getPrincipal().toString(), verifiedJwt, tenantRequestContext);

      log.info("Authenticated with JWT as principal {} from issuer {}", jwtAuthentication.getPrincipal(), verifiedJwt.getIssuer());

      return jwtAuthentication;
    } catch (JwtParseException | JwtVerificationException e) {
      throw new BadCredentialsException("Invalid JWT", e);
    }
  }
}
com.atlassian.jwt.coreSimpleJwtParser<init>

Popular methods of SimpleJwtParser

  • parse
  • parseJWSObject

Popular in Java

  • Finding current android device location
  • findViewById (Activity)
  • addToBackStack (FragmentTransaction)
  • setRequestProperty (URLConnection)
  • Point (java.awt)
    A point representing a location in (x,y) coordinate space, specified in integer precision.
  • Proxy (java.net)
    This class represents proxy server settings. A created instance of Proxy stores a type and an addres
  • Arrays (java.util)
    This class contains various methods for manipulating arrays (such as sorting and searching). This cl
  • Deque (java.util)
    A linear collection that supports element insertion and removal at both ends. The name deque is shor
  • LinkedList (java.util)
    Doubly-linked list implementation of the List and Dequeinterfaces. Implements all optional list oper
  • JTextField (javax.swing)
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now