diff --git a/src/main/java/org/irods/jargon/irodsext/jwt/JwtIssueService.java b/src/main/java/org/irods/jargon/irodsext/jwt/JwtIssueService.java new file mode 100644 index 0000000..99498ee --- /dev/null +++ b/src/main/java/org/irods/jargon/irodsext/jwt/JwtIssueService.java @@ -0,0 +1,31 @@ +package org.irods.jargon.irodsext.jwt; + +import io.jsonwebtoken.Claims; +import io.jsonwebtoken.Jws; + +/** + * Interface for a service to (with proper configuration) issue JWTs for use + * with plug-in microservices + * + * @author Mike Conway - NIEHS + * + */ +public interface JwtIssueService { + + /** + * Given a subject, issue a proper JWT that can be understood by Metalnx plugins + * + * @param subject {@code String} with the subject for the JWT claim + * @return {@code String} with the JWT token + */ + String issueJwtToken(String subject); + + /** + * Given a JWT token, return the decoded claims + * + * @param token {@code String} with the JWT token + * @return {@link Jws} with the associated claims + */ + Jws decodeJwtToken(String token); + +} \ No newline at end of file diff --git a/src/main/java/org/irods/jargon/irodsext/jwt/JwtIssueServiceImpl.java b/src/main/java/org/irods/jargon/irodsext/jwt/JwtIssueServiceImpl.java index 36b0c05..dc084b2 100644 --- a/src/main/java/org/irods/jargon/irodsext/jwt/JwtIssueServiceImpl.java +++ b/src/main/java/org/irods/jargon/irodsext/jwt/JwtIssueServiceImpl.java @@ -18,7 +18,7 @@ * @author Mike Conway - NIEHS * */ -public class JwtIssueServiceImpl { +public class JwtIssueServiceImpl implements JwtIssueService { public static final Logger log = LoggerFactory.getLogger(JwtIssueServiceImpl.class); @@ -39,6 +39,13 @@ public JwtIssueServiceImpl(final JwtServiceConfig jwtServiceConfig) { myKey = Keys.hmacShaKeyFor(jwtServiceConfig.getSecret().getBytes()); } + /* + * (non-Javadoc) + * + * @see + * org.irods.jargon.irodsext.jwt.JwtIssueService#issueJwtToken(java.lang.String) + */ + @Override public String issueJwtToken(final String subject) { log.info("issueJwtToken()"); @@ -52,6 +59,13 @@ public String issueJwtToken(final String subject) { } + /* + * (non-Javadoc) + * + * @see org.irods.jargon.irodsext.jwt.JwtIssueService#decodeJwtToken(java.lang. + * String) + */ + @Override public Jws decodeJwtToken(final String token) { log.info("decodeJwtToken()"); diff --git a/src/test/java/META-INF/MANIFEST.MF b/src/test/java/META-INF/MANIFEST.MF new file mode 100644 index 0000000..5e94951 --- /dev/null +++ b/src/test/java/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Class-Path: +