Package io.antmedia.security
Interface ITokenService
- All Known Implementing Classes:
MockTokenService
public interface ITokenService
-
Nested Class Summary
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Compare hash string with computed one which is based on streamId,type and secretboolean
checkJwtToken
(String jwtTokenId, String streamId, String sessionId, String type) Checks the JWT token validityboolean
checkTimeBasedSubscriber
(String subscriberId, String streamId, String sessionId, String subscriberCode, String type) Checks the time based token validityboolean
checkToken
(String tokenId, String streamId, String sessionId, String type) Checks the token validitycreateJwtToken
(String streamId, long exprireDate, String type, String roomId) creates token according to the provided parameterscreateToken
(String streamId, long exprireDate, String type, String roomId) creates token according to the provided parametersgets map of authenticated sessionsgets map of authenticated subscriber sessionsboolean
isJwtTokenValid
(String jwtTokenId, String tokenSecret, String streamId, String type) Check the JWT token if it's valid.
-
Field Details
-
HMAC_SHA1
- See Also:
-
logger
static final org.slf4j.Logger logger
-
-
Method Details
-
checkHash
Compare hash string with computed one which is based on streamId,type and secret- Parameters:
hash
- - client hashstreamId
- - id of the streamsessionId
- - session of the requesttype
- - type of the request (publish/play)- Returns:
-
checkToken
Checks the token validity- Parameters:
tokenId
- - requested token idstreamId
- - id of the streamsessionId
- - id of the current sessiontype
- - type of the token (play/publish)- Returns:
- true or false
-
checkTimeBasedSubscriber
boolean checkTimeBasedSubscriber(String subscriberId, String streamId, String sessionId, String subscriberCode, String type) Checks the time based token validity- Parameters:
subscriberId
- - requested subscriberIdstreamId
- - id of the streamsessionId
- - id of the current sessionsubscriberCode
- - with TOTP generated codetype
- -or @link Subscriber#PUBLISH_TYPE or @link Subscriber#PLAY_TYPE
- Returns:
- true or false
-
checkJwtToken
Checks the JWT token validity- Parameters:
jwtTokenId
- - requested token idstreamId
- - id of the streamtype
- - type of the token (play/publish)- Returns:
- true or false
-
isJwtTokenValid
boolean isJwtTokenValid(@Nonnull String jwtTokenId, @Nonnull String tokenSecret, @Nonnull String streamId, @Nonnull String type) Check the JWT token if it's valid. It accepts the secret key to check the validity;- Parameters:
jwtTokenId
-tokenSecret
-streamId
-type
-- Returns:
-
createToken
creates token according to the provided parameters- Parameters:
streamId
- - id of the requested stream for token creationexprireDate
- - expire date of the tokentype
- type of the token (play/publish)roomId
- - id of the room for playing streams in the room- Returns:
- token
-
createJwtToken
creates token according to the provided parameters- Parameters:
streamId
- - id of the requested stream for token creationexprireDate
- - expire date of the token (unix timestamp)type
- type of the token (play/publish)roomId
- - id of the room for playing streams in the room- Returns:
- token
-
getAuthenticatedMap
gets map of authenticated sessions- Returns:
- list
-
getSubscriberAuthenticatedMap
gets map of authenticated subscriber sessions- Returns:
- list
-