Package org.picketlink.identity.federation.core.config

Examples of org.picketlink.identity.federation.core.config.ClaimsProcessorType


            String elementName = StaxParserUtil.getStartElementName(subEvent);

            if (CLAIMS_PROCESSOR_ELEMENT.equalsIgnoreCase(elementName)) {
                subEvent = StaxParserUtil.getNextStartElement(xmlEventReader);
                StaxParserUtil.validate(subEvent, CLAIMS_PROCESSOR_ELEMENT);
                ClaimsProcessorType claimsProcessor = new ClaimsProcessorType();

                // parse the processor attributes (class and dialect).
                QName attributeQName = new QName("", PROCESSOR_CLASS_ATTRIB);
                Attribute attribute = subEvent.getAttributeByName(attributeQName);
                if (attribute != null)
                    claimsProcessor.setProcessorClass(StaxParserUtil.getAttributeValue(attribute));
                attributeQName = new QName("", DIALECT_ATTRIB);
                attribute = subEvent.getAttributeByName(attributeQName);
                if (attribute != null)
                    claimsProcessor.setDialect(StaxParserUtil.getAttributeValue(attribute));

                // parse the processor properties.
                while (xmlEventReader.hasNext()) {
                    xmlEvent = StaxParserUtil.peek(xmlEventReader);
                    if (xmlEvent == null)
                        break;
                    if (xmlEvent instanceof EndElement) {
                        EndElement endElement = (EndElement) StaxParserUtil.getNextEvent(xmlEventReader);
                        String endElementName = StaxParserUtil.getEndElementName(endElement);
                        if (endElementName.equals(CLAIMS_PROCESSOR_ELEMENT))
                            break;
                        else
                            throw logger.parserUnknownEndElement(endElementName);
                    }

                    subEvent = StaxParserUtil.peekNextStartElement(xmlEventReader);
                    if (subEvent == null)
                        break;
                    elementName = StaxParserUtil.getStartElementName(subEvent);
                    if (PROPERTY_ELEMENT.equalsIgnoreCase(elementName)) {
                        // parse the property key and value.
                        subEvent = StaxParserUtil.getNextStartElement(xmlEventReader);
                        KeyValueType keyValue = new KeyValueType();
                        // parse the key and value attributes.
                        attributeQName = new QName("", KEY_ATTRIB);
                        attribute = subEvent.getAttributeByName(attributeQName);
                        if (attribute != null)
                            keyValue.setKey(StaxParserUtil.getAttributeValue(attribute));
                        attributeQName = new QName("", VALUE_ATTRIB);
                        attribute = subEvent.getAttributeByName(attributeQName);
                        if (attribute != null)
                            keyValue.setValue(StaxParserUtil.getAttributeValue(attribute));

                        EndElement endElement = StaxParserUtil.getNextEndElement(xmlEventReader);
                        StaxParserUtil.validate(endElement, PROPERTY_ELEMENT);
                        claimsProcessor.add(keyValue);
                    } else
                        throw logger.parserUnknownTag(elementName, subEvent.getLocation());
                }
                claimsProcessors.add(claimsProcessor);
            } else
View Full Code Here


        // check if the claims processors have been set according to the configuration file.
        assertNotNull(stsType.getClaimsProcessors());
        List<ClaimsProcessorType> claimsProcessors = stsType.getClaimsProcessors().getClaimsProcessor();
        assertEquals(2, claimsProcessors.size());
        ClaimsProcessorType claimsProcessor = claimsProcessors.get(0);
        assertEquals("org.picketlink.test.Processor1", claimsProcessor.getProcessorClass());
        assertEquals("urn:test-org:test-dialect:1.0", claimsProcessor.getDialect());
        assertEquals(0, claimsProcessor.getProperty().size());
        claimsProcessor = claimsProcessors.get(1);
        assertEquals("org.picketlink.test.Processor2", claimsProcessor.getProcessorClass());
        assertEquals("urn:test-org:test-dialect:2.0", claimsProcessor.getDialect());
        assertEquals(1, claimsProcessor.getProperty().size());
        assertEquals("SomeKey", claimsProcessor.getProperty().get(0).getKey());
        assertEquals("SomeValue", claimsProcessor.getProperty().get(0).getValue());

        // check if the token providers have been set according to the configuration file.
        assertNotNull(stsType.getTokenProviders());
        List<TokenProviderType> tokenProviders = stsType.getTokenProviders().getTokenProvider();
        assertEquals(2, tokenProviders.size());
View Full Code Here

TOP

Related Classes of org.picketlink.identity.federation.core.config.ClaimsProcessorType

Copyright © 2018 www.massapicom. 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.