Package io.antmedia.filter
Class JWTFilter
java.lang.Object
io.antmedia.filter.AbstractFilter
io.antmedia.filter.JWTFilter
- All Implemented Interfaces:
jakarta.servlet.Filter
-
Field Summary
Modifier and TypeFieldDescriptionprivate AppSettings
static final String
static final String
protected static org.slf4j.Logger
Fields inherited from class io.antmedia.filter.AbstractFilter
BROADCAST_OBJECT, config, logger, streamStats
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprivate boolean
void
doFilter
(jakarta.servlet.ServletRequest request, jakarta.servlet.ServletResponse response, jakarta.servlet.FilterChain chain) static String
generateJwtToken
(String jwtSecretKey, long expireDateUnixTimeStampMs) static String
generateJwtToken
(String jwtSecretKey, long expireDateUnixTimeStampMs, String issuer) static String
generateJwtToken
(String jwtSecretKey, long expireDateUnixTimeStampMs, String claimName, String claimValue) private static boolean
isJWKSTokenValid
(String jwksURL, String jwtString) static boolean
isJWTTokenValid
(String jwtSecretKey, String jwtToken) static boolean
isJWTTokenValid
(String jwtSecretKey, String jwtToken, String issuer) static boolean
isJWTTokenValid
(String jwtSecretKey, String jwtToken, String claimName, String claimValue) This method checks the claim value in the JWT token.Methods inherited from class io.antmedia.filter.AbstractFilter
checkCIDRList, destroy, getAntMediaApplicationAdapter, getAppContext, getAppSettings, getBroadcast, getConfig, getDataStore, getServerSettings, getStreamStats, getTokenService, getWebApplicationContext, init, setConfig, setTokenService
-
Field Details
-
log
protected static org.slf4j.Logger log -
JWT_TOKEN_AUTHORIZATION_HEADER
- See Also:
-
JWT_TOKEN_AUTHORIZATION_HEADER_BEARER_PREFIX
- See Also:
-
appSettings
-
-
Constructor Details
-
JWTFilter
public JWTFilter()
-
-
Method Details
-
doFilter
public void doFilter(jakarta.servlet.ServletRequest request, jakarta.servlet.ServletResponse response, jakarta.servlet.FilterChain chain) throws IOException, jakarta.servlet.ServletException - Throws:
IOException
jakarta.servlet.ServletException
-
checkJWT
-
isJWKSTokenValid
-
isJWTTokenValid
-
isJWTTokenValid
-
isJWTTokenValid
public static boolean isJWTTokenValid(String jwtSecretKey, String jwtToken, String claimName, String claimValue) This method checks the claim value in the JWT token. For instance, we just need to give claimName as `subscriberId` and claimValue as the subscribers' id such as email Typical usage is like that isJWTTokenValid(jwtSecretKey, jwtToken, "subscriberId", "myemail@example.com");- Parameters:
jwtSecretKey
-jwtToken
-claimName
-claimValue
-- Returns:
-
generateJwtToken
-
generateJwtToken
-
generateJwtToken
-