/** * @return The Kerberos message type field */ public KrbMessageType getMsgType() { Integer value = getFieldAsInteger(KrbMessageField.MSG_TYPE); return KrbMessageType.fromValue(value); }
/** * Sets the Kerberos Message Type field * @param msgType The Kerberos Message Type to set */ public void setMsgType(KrbMessageType msgType) { setFieldAsInt(KrbMessageField.MSG_TYPE, msgType.getValue()); } }
/** * {@inheritDoc} */ @Override public String getName() { return name(); }
/** * Get the KrbMessageType associated with a value. * * @param value The integer value of the KrbMessageType we are looking for * @return The associated KrbMessageType, or NONE if not found or if value is null */ public static KrbMessageType fromValue(Integer value) { if (value != null) { for (EnumType e : values()) { if (e.getValue() == value.intValue()) { return (KrbMessageType) e; } } } return NONE; } }
public static ApRep readRep( byte[] buf, EncryptionKey key, long allowableClockSkew, ApReq apReq, InetAddress initiator ) throws KrbException { ApRep apRep = KrbCodec.decode( buf, ApRep.class ); if ( apRep.getPvno() != KrbConstant.KRB_V5 ) { throw new KrbException( KrbErrorCode.KRB_AP_ERR_BADVERSION ); } if ( !apRep.getMsgType().equals( KrbMessageType.AP_REP ) ) { throw new KrbException( KrbErrorCode.KRB_AP_ERR_MSG_TYPE ); } try { ApRequest.validate( key, apReq, initiator, allowableClockSkew * 1000 ); } catch (KrbException e) { // XXX: The checksum verification fails, but we can continue, so just log the error logger.debug("Ap Request validation error: code={}, message={}", e.getKrbErrorCode(), e.getMessage(), e ); } EncAPRepPart encRepPart = EncryptionUtil.unseal( apRep.getEncryptedEncPart(), key, KeyUsage.AP_REP_ENCPART, EncAPRepPart.class ); apRep.setEncRepPart( encRepPart ); ApRequest.unsealAuthenticator( key, apReq ); EncAPRepPart encAPRepPart = apRep.getEncRepPart(); Authenticator authenticator = apReq.getAuthenticator(); if ( !encAPRepPart.getCtime().equals( authenticator.getCtime() ) || encAPRepPart.getCusec() != authenticator.getCusec() ) { throw new KrbException( KrbErrorCode.KRB_AP_ERR_MODIFIED ); } return apRep; }
/** * Get the KrbMessageType associated with a value. * * @param value The integer value of the KrbMessageType we are looking for * @return The associated KrbMessageType, or NONE if not found or if value is null */ public static KrbMessageType fromValue(Integer value) { if (value != null) { for (EnumType e : values()) { if (e.getValue() == value.intValue()) { return (KrbMessageType) e; } } } return NONE; } }
if ( !sessionInfoPriv.getMsgType().equals( KrbMessageType.KRB_PRIV ) )
/** * Sets the Kerberos Message Type field * @param msgType The Kerberos Message Type to set */ public void setMsgType(KrbMessageType msgType) { setFieldAsInt(KrbMessageField.MSG_TYPE, msgType.getValue()); } }
/** * @return The Kerberos message type field */ public KrbMessageType getMsgType() { Integer value = getFieldAsInteger(KrbMessageField.MSG_TYPE); return KrbMessageType.fromValue(value); }
/** * {@inheritDoc} */ @Override public String getName() { return name(); }
/** * Creates a new instance of a KrbMessage. It's not possible to invoque this * constructor directly. * * @param msgType The Kerberos messag etype * @param fieldInfos The fields to use */ protected KrbMessage(KrbMessageType msgType, Asn1FieldInfo[] fieldInfos) { super(msgType.getValue(), fieldInfos); setPvno(pvno); setMsgType(msgType); }
public static KrbMessage decodeMessage(ByteBuffer buffer) throws IOException { Asn1ParseResult parsingResult = Asn1.parse(buffer); Tag tag = parsingResult.tag(); KrbMessage msg; KrbMessageType msgType = KrbMessageType.fromValue(tag.tagNo()); if (msgType == KrbMessageType.TGS_REQ) { msg = new TgsReq(); } else if (msgType == KrbMessageType.AS_REP) { msg = new AsRep(); } else if (msgType == KrbMessageType.AS_REQ) { msg = new AsReq(); } else if (msgType == KrbMessageType.TGS_REP) { msg = new TgsRep(); } else if (msgType == KrbMessageType.AP_REQ) { msg = new ApReq(); } else if (msgType == KrbMessageType.AP_REP) { msg = new ApReq(); } else if (msgType == KrbMessageType.KRB_ERROR) { msg = new KrbError(); } else { throw new IOException("To be supported krb message type with tag: " + tag); } msg.decode(parsingResult); return msg; }
/** * Creates a new instance of a KrbMessage. It's not possible to invoque this * constructor directly. * * @param msgType The Kerberos messag etype * @param fieldInfos The fields to use */ protected KrbMessage(KrbMessageType msgType, Asn1FieldInfo[] fieldInfos) { super(msgType.getValue(), fieldInfos); setPvno(pvno); setMsgType(msgType); }
public static KrbMessage decodeMessage(ByteBuffer buffer) throws IOException { Asn1ParseResult parsingResult = Asn1.parse(buffer); Tag tag = parsingResult.tag(); KrbMessage msg; KrbMessageType msgType = KrbMessageType.fromValue(tag.tagNo()); if (msgType == KrbMessageType.TGS_REQ) { msg = new TgsReq(); } else if (msgType == KrbMessageType.AS_REP) { msg = new AsRep(); } else if (msgType == KrbMessageType.AS_REQ) { msg = new AsReq(); } else if (msgType == KrbMessageType.TGS_REP) { msg = new TgsRep(); } else if (msgType == KrbMessageType.AP_REQ) { msg = new ApReq(); } else if (msgType == KrbMessageType.AP_REP) { msg = new ApReq(); } else if (msgType == KrbMessageType.KRB_ERROR) { msg = new KrbError(); } else { throw new IOException("To be supported krb message type with tag: " + tag); } msg.decode(parsingResult); return msg; }