Skip to content

Commit

Permalink
#1 initial version
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-conway committed Aug 16, 2019
1 parent db157eb commit 4f441de
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 1 deletion.
31 changes: 31 additions & 0 deletions src/main/java/org/irods/jargon/irodsext/jwt/JwtIssueService.java
Original file line number Diff line number Diff line change
@@ -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<Claims> decodeJwtToken(String token);

}
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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()");

Expand All @@ -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<Claims> decodeJwtToken(final String token) {
log.info("decodeJwtToken()");

Expand Down
3 changes: 3 additions & 0 deletions src/test/java/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Manifest-Version: 1.0
Class-Path:

0 comments on commit 4f441de

Please sign in to comment.