本文整理汇总了Java中com.auth0.jwt.algorithms.Algorithm.equals方法的典型用法代码示例。如果您正苦于以下问题:Java Algorithm.equals方法的具体用法?Java Algorithm.equals怎么用?Java Algorithm.equals使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.auth0.jwt.algorithms.Algorithm
的用法示例。
在下文中一共展示了Algorithm.equals方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: sign
import com.auth0.jwt.algorithms.Algorithm; //导入方法依赖的package包/类
/**
* Creates a new JWT and signs it with the given algorithm.
*
* @param algorithm used to sign the JWT
* @return a new JWT token
* @throws IllegalAccessException if the developer didn't want NONE algorithm to be allowed and it was passed in
* @throws IllegalArgumentException if the provided algorithm is null.
* @throws JWTCreationException if the claims could not be converted to a valid JSON or there was a problem with the signing key.
*/
public String sign(Algorithm algorithm) throws Exception {
if(!jwt.getIsNoneAlgorithmAllowed() && algorithm.equals(Algorithm.none())) {
throw new IllegalAccessException("None algorithm isn't allowed");
}
String JWS = jwt.sign(algorithm);
verifyClaims();
return JWS;
}
示例2: signBase16Encoding
import com.auth0.jwt.algorithms.Algorithm; //导入方法依赖的package包/类
/**
* Creates a new JWT and signs it with the given algorithm.
*
* @param algorithm used to sign the JWT
* @return a new JWT token
* @throws IllegalAccessException if the developer didn't want NONE algorithm to be allowed and it was passed in
* @throws IllegalArgumentException if the provided algorithm is null.
* @throws JWTCreationException if the claims could not be converted to a valid JSON or there was a problem with the signing key.
*/
public String signBase16Encoding(Algorithm algorithm) throws Exception {
if(!jwt.getIsNoneAlgorithmAllowed() && algorithm.equals(Algorithm.none())) {
throw new IllegalAccessException("None algorithm isn't allowed");
}
String JWS = jwt.sign(algorithm, EncodeType.Base16);
verifyClaims();
return JWS;
}
示例3: signBase32Encoding
import com.auth0.jwt.algorithms.Algorithm; //导入方法依赖的package包/类
/**
* Creates a new JWT and signs it with the given algorithm.
*
* @param algorithm used to sign the JWT
* @return a new JWT token
* @throws IllegalAccessException if the developer didn't want NONE algorithm to be allowed and it was passed in
* @throws IllegalArgumentException if the provided algorithm is null.
* @throws JWTCreationException if the claims could not be converted to a valid JSON or there was a problem with the signing key.
*/
public String signBase32Encoding(Algorithm algorithm) throws Exception {
if(!jwt.getIsNoneAlgorithmAllowed() && algorithm.equals(Algorithm.none())) {
throw new IllegalAccessException("None algorithm isn't allowed");
}
String JWS = jwt.sign(algorithm, EncodeType.Base32);
verifyClaims();
return JWS;
}