Examples of PrincipalName


Examples of org.apache.directory.shared.kerberos.components.PrincipalName

            authenticator.getCName(),
            authenticator.getCRealm() );

        KerberosPrincipal targetPrincipal = null;

        PrincipalName targName = changepwContext.getPasswordData().getTargName();
       
        if ( targName != null )
        {
            targetPrincipal = new KerberosPrincipal( targName.getNameString(), PrincipalNameType.KRB_NT_PRINCIPAL.getValue() );
        }
        else
        {
            targetPrincipal = byPrincipal;
        }
View Full Code Here

Examples of org.apache.directory.shared.kerberos.components.PrincipalName

        {
            fail( de.getMessage() );
        }

        // Check the decoded PrincipalName
        PrincipalName principalName = ( ( PrincipalNameContainer ) principalNameContainer ).getPrincipalName();

        assertEquals( PrincipalNameType.KRB_NT_PRINCIPAL, principalName.getNameType() );
        assertTrue( principalName.getNames().contains( "hnelson1" ) );
        assertTrue( principalName.getNames().contains( "hnelson2" ) );
        assertTrue( principalName.getNames().contains( "hnelson3" ) );

        // Check the encoding
        ByteBuffer bb = ByteBuffer.allocate( principalName.computeLength() );

        try
        {
            bb = principalName.encode( bb );

            // Check the length
            assertEquals( 0x29, bb.limit() );

            String encodedPdu = Strings.dumpBytes( bb.array() );
View Full Code Here

Examples of org.apache.directory.shared.kerberos.components.PrincipalName

    @Test
    public void testStartTimeAbsentNoPostdate() throws Exception
    {
        KdcReqBody kdcReqBody = new KdcReqBody();
        kdcReqBody.setCName( getPrincipalName( "hnelson" ) );
        kdcReqBody.setSName( new PrincipalName( new KerberosPrincipal( "krbtgt/EXAMPLE.COM@EXAMPLE.COM" ) ) );
        kdcReqBody.setRealm( "EXAMPLE.COM" );
        kdcReqBody.setEType( config.getEncryptionTypes() );

        kdcReqBody.setKdcOptions( new KdcOptions() );
View Full Code Here

Examples of org.apache.directory.shared.kerberos.components.PrincipalName

    {
        KerberosPrincipal servicePrincipalName = new KerberosPrincipal( "ldap/ldap.example.com@EXAMPLE.COM" );

        KdcReqBody kdcReqBody = new KdcReqBody();
        kdcReqBody.setCName( getPrincipalName( "hnelson" ) );
        kdcReqBody.setSName( new PrincipalName( servicePrincipalName ) );
        kdcReqBody.setRealm( "EXAMPLE.COM" );
        kdcReqBody.setEType( config.getEncryptionTypes() );

        kdcReqBody.setKdcOptions( new KdcOptions() );
View Full Code Here

Examples of org.apache.directory.shared.kerberos.components.PrincipalName

        {
            throw new KerberosException( ErrorType.KRB_AP_ERR_BAD_INTEGRITY, de );
        }

        // get the decoded PrincipalName
        PrincipalName principalName = ( ( PrincipalNameContainer ) principalNameContainer ).getPrincipalName();

        return principalName;
    }
View Full Code Here

Examples of org.apache.directory.shared.kerberos.components.PrincipalName

            // This will generate a PROTOCOL_ERROR
            throw new DecoderException( I18n.err( I18n.ERR_744_NULL_PDU_LENGTH ) );
        }

        // Get the principalName
        PrincipalName principalName = principalNameContainer.getPrincipalName();

        BerValue value = tlv.getValue();

        // The PrincipalName must be pure ASCII witout any control character
        if ( KerberosUtils.isKerberosString( value.getData() ) )
        {
            String nameString = Strings.utf8ToString( value.getData() );

            principalName.addName( nameString );
            principalNameContainer.setGrammarEndAllowed( true );

            if ( IS_DEBUG )
            {
                LOG.debug( "PrincipalName String : {}", nameString );
View Full Code Here

Examples of org.apache.directory.shared.kerberos.components.PrincipalName

            // This will generate a PROTOCOL_ERROR
            throw new DecoderException( I18n.err( I18n.ERR_744_NULL_PDU_LENGTH ) );
        }

        // We have to create a PrincipalName object here
        PrincipalName principalName = new PrincipalName();
        principalNameContainer.setPrincipalName( principalName );

        if ( IS_DEBUG )
        {
            LOG.debug( "PrincipalName created" );
View Full Code Here

Examples of org.apache.directory.shared.kerberos.components.PrincipalName

     * {@inheritDoc}
     */
    @Override
    protected void setIntegerValue( int value, PrincipalNameContainer principalNameContainer )
    {
        PrincipalName principalName = principalNameContainer.getPrincipalName();

        PrincipalNameType principalNameType = PrincipalNameType.getTypeByValue( value );
        principalName.setNameType( principalNameType );

        if ( IS_DEBUG )
        {
            LOG.debug( "name-type : {}" + principalNameType );
        }
View Full Code Here

Examples of org.apache.directory.shared.kerberos.components.PrincipalName

        encTicketPart.setFlags( ticketFlags );

        EncryptionKey sessionKey = RandomKeyFactory.getRandomKey( EncryptionType.AES128_CTS_HMAC_SHA1_96 );

        encTicketPart.setKey( sessionKey );
        encTicketPart.setCName( new PrincipalName( clientPrincipal ) );
        encTicketPart.setCRealm( clientPrincipal.getRealm() );
        encTicketPart.setTransited( new TransitedEncoding() );
        encTicketPart.setAuthTime( new KerberosTime() );

        long now = System.currentTimeMillis();
        KerberosTime endTime = new KerberosTime( now + KerberosTime.DAY );
        encTicketPart.setEndTime( endTime );

        KerberosTime renewTill = new KerberosTime( now + KerberosTime.WEEK );
        encTicketPart.setRenewTill( renewTill );

        EncryptedData encryptedTicketPart = lockBox.seal( serverKey, encTicketPart,
            KeyUsage.AS_OR_TGS_REP_TICKET_WITH_SRVKEY );

        Ticket ticket = new Ticket();
        ticket.setSName( new PrincipalName( serverPrincipal.getName(), serverPrincipal.getNameType() ) );
        ticket.setRealm( serverPrincipal.getRealm() );
        ticket.setEncPart( encryptedTicketPart );

        ticket.setEncTicketPart( encTicketPart );
View Full Code Here

Examples of org.apache.directory.shared.kerberos.components.PrincipalName

        encTicketPart.setFlags( ticketFlags );

        EncryptionKey sessionKey = RandomKeyFactory.getRandomKey( EncryptionType.AES128_CTS_HMAC_SHA1_96 );

        encTicketPart.setKey( sessionKey );
        encTicketPart.setCName( new PrincipalName( clientPrincipal ) );
        encTicketPart.setCRealm( clientPrincipal.getRealm() );
        encTicketPart.setTransited( new TransitedEncoding() );
        encTicketPart.setAuthTime( new KerberosTime() );

        long now = System.currentTimeMillis();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.