Package org.apache.wss4j.common.ext

Examples of org.apache.wss4j.common.ext.AttachmentRequestCallback


    @Override
    public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
        for (int i = 0; i < callbacks.length; i++) {
            Callback callback = callbacks[i];
            if (callback instanceof AttachmentRequestCallback) {
                AttachmentRequestCallback attachmentRequestCallback = (AttachmentRequestCallback) callback;

                List<org.apache.wss4j.common.ext.Attachment> attachmentList =
                    new ArrayList<org.apache.wss4j.common.ext.Attachment>();
                attachmentRequestCallback.setAttachments(attachmentList);
               
                String attachmentId = attachmentRequestCallback.getAttachmentId();
                if ("Attachments".equals(attachmentId)) {
                    // Load all attachments
                    attachmentId = null;
                }
                loadAttachments(attachmentList, attachmentId);
View Full Code Here


                    throw new WSSecurityException(WSSecurityException.ErrorCode.FAILED_CHECK);
                }

                final String attachmentId = uri.substring(4);

                AttachmentRequestCallback attachmentRequestCallback = new AttachmentRequestCallback();
                attachmentRequestCallback.setAttachmentId(attachmentId);

                attachmentCallbackHandler.handle(new Callback[]{attachmentRequestCallback});
                List<Attachment> attachments = attachmentRequestCallback.getAttachments();
                if (attachments == null || attachments.isEmpty() || !attachmentId.equals(attachments.get(0).getId())) {
                    throw new WSSecurityException(
                            WSSecurityException.ErrorCode.INVALID_SECURITY,
                            "empty", "Attachment not found"
                    );
View Full Code Here

                            WSSecurityException.ErrorCode.FAILURE,
                            "empty", "no attachment callbackhandler supplied"
                    );
                }

                AttachmentRequestCallback attachmentRequestCallback = new AttachmentRequestCallback();
                //no mime type must be set for signature:
                //attachmentCallback.setResultingMimeType(null);
                String id = encPart.getId().substring(4);
                attachmentRequestCallback.setAttachmentId(id);
                try {
                    attachmentCallbackHandler.handle(new Callback[]{attachmentRequestCallback});
                } catch (Exception e) {
                    throw new WSSecurityException(
                            WSSecurityException.ErrorCode.FAILURE, e
                    );
                }
                List<Attachment> attachments = attachmentRequestCallback.getAttachments();
                for (int i = 0; i < attachments.size(); i++) {
                    Attachment attachment = attachments.get(i);

                    try {
                        List<Transform> transforms = new ArrayList<Transform>();
View Full Code Here

                            WSSecurityException.ErrorCode.FAILURE,
                            "empty", "no attachment callbackhandler supplied"
                    );
                }

                AttachmentRequestCallback attachmentRequestCallback = new AttachmentRequestCallback();
                String id = encPart.getId().substring(4);
                attachmentRequestCallback.setAttachmentId(id);
                try {
                    attachmentCallbackHandler.handle(new Callback[]{attachmentRequestCallback});
                } catch (Exception e) {
                    throw new WSSecurityException(
                            WSSecurityException.ErrorCode.FAILED_ENCRYPTION, e
                    );
                }
                String attachmentEncryptedDataType;
                if ("Element".equals(encPart.getEncModifier())) {
                    attachmentEncryptedDataType = WSConstants.SWA_ATTACHMENT_ENCRYPTED_DATA_TYPE_COMPLETE;
                } else {
                    attachmentEncryptedDataType = WSConstants.SWA_ATTACHMENT_ENCRYPTED_DATA_TYPE_CONTENT_ONLY;
                }

                List<Attachment> attachments = attachmentRequestCallback.getAttachments();
                for (int i = 0; i < attachments.size(); i++) {
                    Attachment attachment = attachments.get(i);

                    final String attachmentId = attachment.getId();
                    String encEncryptedDataId = config.getIdAllocator().createId("ED-", attachmentId);
View Full Code Here

                    throw new WSSecurityException(WSSecurityException.ErrorCode.FAILED_CHECK);
                }

                final String attachmentId = uri.substring(4);

                AttachmentRequestCallback attachmentRequestCallback = new AttachmentRequestCallback();
                attachmentRequestCallback.setAttachmentId(attachmentId);

                attachmentCallbackHandler.handle(new Callback[]{attachmentRequestCallback});
                List<Attachment> attachments = attachmentRequestCallback.getAttachments();
                if (attachments == null || attachments.isEmpty() || !attachmentId.equals(attachments.get(0).getId())) {
                    throw new WSSecurityException(
                            WSSecurityException.ErrorCode.INVALID_SECURITY,
                            "empty", "Attachment not found"
                    );
View Full Code Here

TOP

Related Classes of org.apache.wss4j.common.ext.AttachmentRequestCallback

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.