All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.kerb4j.server.marshall.pac.PacDelegationInfo Maven / Gradle / Ivy

There is a newer version: 0.2.0
Show newest version
package com.kerb4j.server.marshall.pac;

import com.kerb4j.server.marshall.Kerb4JException;

import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
import java.io.IOException;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

/**
 * Structure representing the S4U_DELEGATION_INFO record
 * 
 * @author bugeaud at gmail dot com
 */
public class PacDelegationInfo {

    private String proxyTarget;
    private List transitedServices;
		
    public PacDelegationInfo(byte[] data) throws Kerb4JException {
        try {
            final PacDataInputStream pacStream = new PacDataInputStream(new DataInputStream(
                    new ByteArrayInputStream(data)));

            // Skip firsts
            // Jaaslounge is assuming here that the DREP Header of the RPC marshaling will always be the same :
            // Byte Order = LE, HDR Length = 9 ...
            pacStream.skipBytes(20);

            final PacUnicodeString proxyTargetString = pacStream.readUnicodeString();
                        
            final int transitedListSize = pacStream.readInt();
            final PacUnicodeString[] transitedServiceStrings = new PacUnicodeString[transitedListSize];
            
            // skip the pointer that should be 0x2008 as per NDR encoding
            pacStream.skipBytes(4);
            proxyTarget = proxyTargetString.check(pacStream.readString());
            
            final int listSize = pacStream.readInt();
            
            if(transitedListSize!=listSize) throw new Kerb4JException("pac.delegationinfo.transitedlist.sizenotmatching");
            
            for(int i=0;i getTransitedServices(){
    	return transitedServices;
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy