/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2006 Sun Microsystems Inc. All Rights Reserved
*
* The contents of this file are subject to the terms
* of the Common Development and Distribution License
* (the License). You may not use this file except in
* compliance with the License.
*
* You can obtain a copy of the License at
* See the License for the specific language governing
* permission and limitations under the License.
*
* When distributing Covered Code, include this CDDL
* Header Notice in each file and include the License file
* at opensso/legal/CDDLv1.0.txt.
* If applicable, add the following below the CDDL Header,
* with the fields enclosed by brackets [] replaced by
* your own identifying information:
* "Portions Copyrighted [year] [name of copyright owner]"
*
* $Id: CramMD5MechanismHandler.java,v 1.8 2008/12/16 20:54:03 hengming Exp $
*
* Portions Copyrighted 2016 ForgeRock AS.
*/
/**
* The <code>CramMD5MechanismHandler</code> is a handler for 'CRAM-MD5'
* mechanism.
*/
PROP_SERVER_HOST, "localhost");
private static final int NUM_RANDOM_DIGITS =
/**
* The block length in characters used in generating an HMAC-MD5 digest.
*/
/**
* table to convert a nibble to a hex char.
*/
'4' , '5' , '6' , '7' ,
'8' , '9' , 'a' , 'b' ,
'c' , 'd' , 'e' , 'f' };
"com.sun.identity.liberty.ws.authnsvc.challengeCleanupInterval";
"com.sun.identity.liberty.ws.soap.staleTimeLimit";
(long) challenge_cleanup_interval, (long) stale_time_limit);
static {
try {
if (debug.warningEnabled()) {
"CramMD5MechanismHandler.static:" +
" Unable to get stale time limit. Default" +
" value will be used", ex);
}
}
}
try {
if (debug.warningEnabled()) {
"CramMD5MechanismHandler.static:" +
" Unable to get stale time limit. Default " +
"value will be used");
}
}
}
/ 1000) * 1000));
}
/**
* Generates a SASL response according to the SASL request.
* @param saslReq a SASL request
* @param message a SOAP Message containing the SASL request
* @param respMessageID messageID of SOAP Message response that will
* contain returned SASL response
* @return a SASL response
*/
if (debug.messageEnabled()) {
}
if (debug.messageEnabled()) {
"refToMessageID = " + refToMessageID);
}
if (isFirstRequest) {
byte[] challenge = generateChallenge();
if (debug.messageEnabled()) {
+ " add respMessageID: " + respMessageID);
}
} else {
}
} else {
try {
}
} else {
}
if (isFirstRequest) {
}
}
return saslResp;
}
if (index == -1) {
}
if (debug.messageEnabled()) {
"CramMD5MechanismHandler.authenticate: can't get password");
}
}
if (debug.messageEnabled()) {
"CramMD5MechanismHandler.authenticate: no refToMessageID");
}
}
byte[] challengeBytes = null;
if (debug.messageEnabled()) {
" remove refToMessageID: " + refToMessageID);
}
if (challengeBytes == null) {
if (debug.messageEnabled()) {
"CramMD5MechanismHandler.authenticate: no challenge found");
}
}
byte[] passwordBytes = null;
try {
} catch (UnsupportedEncodingException ueex) {
}
try {
} catch(NoSuchAlgorithmException nsaex) {
}
if (debug.messageEnabled()) {
"CramMD5MechanismHandler.authenticate: digests not equal");
}
}
if (debug.messageEnabled()) {
"CramMD5MechanismHandler.authenticate: digests equal");
}
if (debug.messageEnabled()) {
"authModule = " + authModule);
}
try {
} catch (AuthLoginException le) {
}
if (authContext.hasMoreRequirements()) {
}
}
if (debug.messageEnabled()) {
"CramMD5MechanismHandler.authenticate: login status = " +
}
}
try {
try {
} catch (SSOException ssoex) {
"PlainMechanismHandler.authenticate:", ssoex);
}
}
}
return saslResp;
}
}
if (debug.messageEnabled()) {
}
if (callback instanceof NameCallback) {
} else if (callback instanceof PasswordCallback) {
password.toCharArray());
}
}
}
private static byte[] generateChallenge() {
// append random digits
}
// append timestamp
// append hostname
try {
} catch (UnsupportedEncodingException ueex) {
}
}
try {
searchControl.setAllReturnAttributes(false);
if (debug.messageEnabled()) {
"no user found");
}
return null;
}
if (debug.messageEnabled()) {
"more than 1 user found");
}
return null;
}
if (debug.messageEnabled()) {
"user has no password");
}
return null;
}
if (debug.messageEnabled()) {
"user has more than 1 passwords");
}
return null;
}
}
return password;
"CramMD5MechanismHandler.getUserPassword: ", ex);
return null;
}
}
byte[] challengeBytes)
throws NoSuchAlgorithmException
{
}
byte abyte2[] = new byte[BLOCK_LENGTH];
byte abyte3[] = new byte[BLOCK_LENGTH];
}
}
return toHexString(digestBytes);
}
for ( int i=0; i<b.length; i++ ) {
}
}
}