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
FieldsModifier and TypeFieldDescriptionprivate AppSettingsstatic final Stringstatic final Stringprotected static org.slf4j.LoggerFields inherited from class io.antmedia.filter.AbstractFilter
BROADCAST_OBJECT, config, logger, streamStats -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate booleanvoiddoFilter(jakarta.servlet.ServletRequest request, jakarta.servlet.ServletResponse response, jakarta.servlet.FilterChain chain) static StringgenerateJwtToken(String jwtSecretKey, long expireDateUnixTimeStampMs) static StringgenerateJwtToken(String jwtSecretKey, long expireDateUnixTimeStampMs, String issuer) static StringgenerateJwtToken(String jwtSecretKey, long expireDateUnixTimeStampMs, String claimName, String claimValue) private static booleanisJWKSTokenValid(String jwksURL, String jwtString) static booleanisJWTTokenValid(String jwtSecretKey, String jwtToken) static booleanisJWTTokenValid(String jwtSecretKey, String jwtToken, String issuer) static booleanisJWTTokenValid(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:
IOExceptionjakarta.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", "[email protected]");- Parameters:
jwtSecretKey-jwtToken-claimName-claimValue-- Returns:
-
generateJwtToken
-
generateJwtToken
-
generateJwtToken
-