/** * Configures ExternalTokenService if missing */ @Bean @ConditionalOnMissingBean(GreenTokenService.class) public GreenTokenService greenTokenService(LemonProperties properties) throws KeyLengthException { log.info("Configuring ExternalTokenService"); return new LemonJweService(properties.getJwt().getSecret()); }
@Override public String createToken(String aud, String subject, Long expirationMillis, Map<String, Object> claimMap) { Payload payload = createPayload(aud, subject, expirationMillis, claimMap); // Create the JWE object and encrypt it JWEObject jweObject = new JWEObject(header, payload); try { jweObject.encrypt(encrypter); } catch (JOSEException e) { throw new RuntimeException(e); } // Serialize to compact JOSE form... return jweObject.serialize(); }