Package org.mycore.frontend.support
Class MCRSecureTokenV2
java.lang.Object
org.mycore.frontend.support.MCRSecureTokenV2
An implementation of SecureToken V2 used by "Wowza Streaming Engine".
A description of the algorithm:
- A string is constructed by combining
contentPath
,'?' and all alphabetically sorted parameters consisting ofipAddress
,sharedSecret
and anyqueryParameters
- Generate an
SHA-256
hash of that string builded in step 1 andStandardCharsets.UTF_8
. - Generate a
Base64
encoded string of the digest of step 2. - replace
'+'
by'-'
and'/'
by'_'
to make it a safe parameter value.
- Author:
- Thomas Scheffler (yagee)
- See Also:
-
Constructor Summary
ConstructorDescriptionMCRSecureTokenV2
(String contentPath, String ipAddress, String sharedSecret, String... queryParameters) -
Method Summary
Modifier and TypeMethodDescriptionboolean
getHash()
int
hashCode()
Same as callingtoURI(String, String, String)
withsuffix=""
.Constructs an URL by using all information from theconstructor
exceptipAddress
andsharedSecret
and the supplied parameters.
-
Constructor Details
-
MCRSecureTokenV2
-
-
Method Details
-
getHash
-
toURI
Same as callingtoURI(String, String, String)
withsuffix=""
.- Throws:
URISyntaxException
-
toURI
Constructs an URL by using all information from theconstructor
exceptipAddress
andsharedSecret
and the supplied parameters.- Parameters:
baseURL
- a valid and absolute base URLsuffix
- is appended to thecontentPath
hashParameterName
- the name of the query parameter that holds the hash value- Returns:
- an absolute URL consisting of all elements as stated above and
queryParameters
in the given order appended by the hash parameter and the hash value fromgetHash()
. - Throws:
URISyntaxException
- if baseURL is not a valid URI
-
hashCode
public int hashCode() -
equals
-