本文整理汇总了Java中org.restlet.engine.security.AuthenticatorUtils类的典型用法代码示例。如果您正苦于以下问题:Java AuthenticatorUtils类的具体用法?Java AuthenticatorUtils怎么用?Java AuthenticatorUtils使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AuthenticatorUtils类属于org.restlet.engine.security包,在下文中一共展示了AuthenticatorUtils类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getChallengeResponse
import org.restlet.engine.security.AuthenticatorUtils; //导入依赖的package包/类
@Override
public ChallengeResponse getChallengeResponse() {
ChallengeResponse result = super.getChallengeResponse();
if (!this.securityAdded) {
// Extract the header value
String authorization = getHeaders().getValues(HeaderConstants.HEADER_AUTHORIZATION);
// Set the challenge response
result = AuthenticatorUtils.parseResponse(this, authorization, getHeaders());
setChallengeResponse(result);
this.securityAdded = true;
}
return result;
}
示例2: getProxyChallengeResponse
import org.restlet.engine.security.AuthenticatorUtils; //导入依赖的package包/类
@Override
public ChallengeResponse getProxyChallengeResponse() {
ChallengeResponse result = super.getProxyChallengeResponse();
if (!this.proxySecurityAdded) {
// Extract the header value
final String authorization = getHeaders().getValues(HeaderConstants.HEADER_PROXY_AUTHORIZATION);
// Set the challenge response
result = AuthenticatorUtils.parseResponse(this, authorization, getHeaders());
setProxyChallengeResponse(result);
this.proxySecurityAdded = true;
}
return result;
}
示例3: getChallengeResponse
import org.restlet.engine.security.AuthenticatorUtils; //导入依赖的package包/类
@Override
public ChallengeResponse getChallengeResponse() {
ChallengeResponse result = super.getChallengeResponse();
if (!this.securityAdded) {
// Extract the header value
String authorization = getHttpCall().getRequestHeaders().getValues(HeaderConstants.HEADER_AUTHORIZATION);
// Set the challenge response
result = AuthenticatorUtils.parseResponse(this, authorization, getHttpCall().getRequestHeaders());
setChallengeResponse(result);
this.securityAdded = true;
}
return result;
}
示例4: getProxyChallengeResponse
import org.restlet.engine.security.AuthenticatorUtils; //导入依赖的package包/类
@Override
public ChallengeResponse getProxyChallengeResponse() {
ChallengeResponse result = super.getProxyChallengeResponse();
if (!this.proxySecurityAdded) {
// Extract the header value
final String authorization = getHttpCall().getRequestHeaders()
.getValues(HeaderConstants.HEADER_PROXY_AUTHORIZATION);
// Set the challenge response
result = AuthenticatorUtils.parseResponse(this, authorization, getHttpCall().getRequestHeaders());
setProxyChallengeResponse(result);
this.proxySecurityAdded = true;
}
return result;
}
示例5: update
import org.restlet.engine.security.AuthenticatorUtils; //导入依赖的package包/类
/**
* Returns the request URI.
*
* @param resourceRef
* The resource reference.
* @param request
* The parent request.
* @return The absolute request URI.
*/
public static Reference update(Reference resourceRef, Request request) {
Reference result = resourceRef.isAbsolute() ? resourceRef :
resourceRef.getTargetRef();
// Optionally update the request before formatting its URI
result = AuthenticatorUtils.updateReference(result,
request.getChallengeResponse(), request);
return result;
}
示例6: formatResponseDigest
import org.restlet.engine.security.AuthenticatorUtils; //导入依赖的package包/类
/**
* Formats the response digest.
*
* @param challengeResponse
* The challenge response.
* @param request
* The request if available.
* @return The formatted secret of a challenge response.
*/
public char[] formatResponseDigest(ChallengeResponse challengeResponse,
Request request) {
String a1 = null;
if (!Digest.ALGORITHM_HTTP_DIGEST.equals(challengeResponse
.getSecretAlgorithm())) {
if (!AuthenticatorUtils
.anyNull(challengeResponse.getIdentifier(),
challengeResponse.getSecret(),
challengeResponse.getRealm())) {
a1 = DigestUtils.toHttpDigest(
challengeResponse.getIdentifier(),
challengeResponse.getSecret(),
challengeResponse.getRealm());
}
} else {
a1 = new String(challengeResponse.getSecret());
}
if (a1 != null
&& !AuthenticatorUtils.anyNull(request.getMethod(),
challengeResponse.getDigestRef())) {
String a2 = DigestUtils.toMd5(request.getMethod().toString() + ":"
+ challengeResponse.getDigestRef().toString());
StringBuilder sb = new StringBuilder().append(a1).append(':')
.append(challengeResponse.getServerNonce());
if (!AuthenticatorUtils.anyNull(challengeResponse.getQuality(),
challengeResponse.getClientNonce(),
challengeResponse.getServerNounceCount())) {
sb.append(':')
.append(AuthenticatorUtils
.formatNonceCount(challengeResponse
.getServerNounceCount())).append(':')
.append(challengeResponse.getClientNonce()).append(':')
.append(challengeResponse.getQuality());
}
sb.append(':').append(a2);
return DigestUtils.toMd5(sb.toString()).toCharArray();
}
return null;
}