protected void decodeRequestAttributes(String sharedSecret) 
	throws RadiusException {
		// detect auth protocol 
		RadiusAttribute userPassword = getAttribute(USER_PASSWORD);
		RadiusAttribute chapPassword = getAttribute(CHAP_PASSWORD);
		RadiusAttribute chapChallenge = getAttribute(CHAP_CHALLENGE);
		
		RadiusAttribute mschapv2Response = getVendorAttribute(MS_VENDOR_ID, MSCHAPV2_RESPONSE);
		RadiusAttribute mschapv2Challenge = getVendorAttribute(MS_VENDOR_ID, MSCHAPV2_CHALLENGE);
		
		if (userPassword != null) {
			setAuthProtocol(AUTH_PAP);
			this.password = decodePapPassword(userPassword.getAttributeData(), RadiusUtil.getUtf8Bytes(sharedSecret));
			// copy truncated data
			userPassword.setAttributeData(RadiusUtil.getUtf8Bytes(this.password));
		} else if(mschapv2Response != null && mschapv2Challenge != null) {
			setAuthProtocol(AUTH_MSCHAPV2);
			this.chapChallenge = mschapv2Challenge.getAttributeData();
			if(chapPassword != null) {
				this.chapPassword = chapPassword.getAttributeData();
			}
			
			List<byte[]> responseComponents = decodeMSCHAPV2Response(mschapv2Response.getAttributeData());
			this.ntResponse = responseComponents.get(0);
			this.peerChallenge = responseComponents.get(1);
		} else if (chapPassword != null && chapChallenge != null) {
			setAuthProtocol(AUTH_CHAP);
			this.chapPassword = chapPassword.getAttributeData();
			this.chapChallenge = chapChallenge.getAttributeData();
		} else if (chapPassword != null && getAuthenticator().length == 16) {
			// thanks to Guillaume Tartayre
            setAuthProtocol(AUTH_CHAP);
            this.chapPassword = chapPassword.getAttributeData();
            this.chapChallenge = getAuthenticator();
		} else
			throw new RadiusException("Access-Request: User-Password or CHAP-Password/CHAP-Challenge missing");
	}