Package org.apache.rahas.impl.util

Examples of org.apache.rahas.impl.util.SAMLAttributeCallback


        Attribute[] attributes = null;

        //Call the attribute callback handlers to get any attributes if exists
        if (config.getCallbackHandler() != null) {
            SAMLAttributeCallback cb = new SAMLAttributeCallback(data);
            SAMLCallbackHandler handler = config.getCallbackHandler();
            handler.handle(cb);
            attributes = cb.getSAML2Attributes();
        }
        else if (config.getCallbackHandlerName() != null
                && config.getCallbackHandlerName().trim().length() > 0) {
            SAMLAttributeCallback cb = new SAMLAttributeCallback(data);
            SAMLCallbackHandler handler = null;
            MessageContext msgContext = data.getInMessageContext();
            ClassLoader classLoader = msgContext.getAxisService().getClassLoader();
            Class cbClass = null;
            try {
                cbClass = Loader.loadClass(classLoader, config.getCallbackHandlerName());
            } catch (ClassNotFoundException e) {
                throw new TrustException("cannotLoadPWCBClass", new String[]{config
                        .getCallbackHandlerName()}, e);
            }
            try {
                handler = (SAMLCallbackHandler) cbClass.newInstance();
            } catch (java.lang.Exception e) {
                throw new TrustException("cannotCreatePWCBInstance", new String[]{config
                        .getCallbackHandlerName()}, e);
            }
            handler.handle(cb);
            attributes = cb.getSAML2Attributes();
            // else add the attribute with a default value
        }

        //else add the attribute with a default value
        else {
View Full Code Here


                    .asList(confirmationMethods), null, keyInfoElem);

          
            SAMLAttribute[] attrs = null;
            if(config.getCallbackHandler() != null){
              SAMLAttributeCallback cb = new SAMLAttributeCallback(data);
              SAMLCallbackHandler handler = config.getCallbackHandler();
              handler.handle(cb);
              attrs = cb.getAttributes();
            } else if (config.getCallbackHandlerName() != null
          && config.getCallbackHandlerName().trim().length() > 0) {
        SAMLAttributeCallback cb = new SAMLAttributeCallback(data);
        SAMLCallbackHandler handler = null;
        MessageContext msgContext = data.getInMessageContext();
        ClassLoader classLoader = msgContext.getAxisService().getClassLoader();
        Class cbClass = null;
        try {
          cbClass = Loader.loadClass(classLoader, config.getCallbackHandlerName());
        } catch (ClassNotFoundException e) {
          throw new TrustException("cannotLoadPWCBClass", new String[]{config
              .getCallbackHandlerName()}, e);
        }
        try {
          handler = (SAMLCallbackHandler) cbClass.newInstance();
        } catch (java.lang.Exception e) {
          throw new TrustException("cannotCreatePWCBInstance", new String[]{config
              .getCallbackHandlerName()}, e);
        }
        handler.handle(cb);
        attrs = cb.getAttributes();
            }else{
              //TODO Remove this after discussing
                SAMLAttribute attribute = new SAMLAttribute("Name",
                        "https://rahas.apache.org/saml/attrns", null, -1, Arrays
                                .asList(new String[] { "Colombo/Rahas" }));
View Full Code Here

public class SAMLDataProvider implements SAMLCallbackHandler{
 
  public void handle(SAMLCallback callback) throws SAMLException{
   
    if(callback.getCallbackType() == SAMLCallback.ATTR_CALLBACK){
      SAMLAttributeCallback cb = (SAMLAttributeCallback)callback;
      SAMLAttribute attribute = new SAMLAttribute("Name",
                     "https://rahas.apache.org/saml/attrns", null, -1, Arrays
                             .asList(new String[] { "Custom/Rahas" }));
      cb.addAttributes(attribute);
    }else if(callback.getCallbackType() == SAMLCallback.NAME_IDENTIFIER_CALLBACK){
      SAMLNameIdentifierCallback cb = (SAMLNameIdentifierCallback)callback;
      SAMLNameIdentifier nameId = new SAMLNameIdentifier(
                "David", null, SAMLNameIdentifier.FORMAT_EMAIL);
      cb.setNameId(nameId);
    }
   
  }
View Full Code Here

        Attribute[] attributes = null;

        //Call the attribute callback handlers to get any attributes if exists
        if (config.getCallbackHandler() != null) {
            SAMLAttributeCallback cb = new SAMLAttributeCallback(data);
            SAMLCallbackHandler handler = config.getCallbackHandler();
            handler.handle(cb);
            attributes = cb.getSAML2Attributes();
        }
        else if (config.getCallbackHandlerName() != null
                && config.getCallbackHandlerName().trim().length() > 0) {
            SAMLAttributeCallback cb = new SAMLAttributeCallback(data);
            SAMLCallbackHandler handler = null;
            MessageContext msgContext = data.getInMessageContext();
            ClassLoader classLoader = msgContext.getAxisService().getClassLoader();
            Class cbClass = null;
            try {
                cbClass = Loader.loadClass(classLoader, config.getCallbackHandlerName());
            } catch (ClassNotFoundException e) {
                throw new TrustException("cannotLoadPWCBClass", new String[]{config
                        .getCallbackHandlerName()}, e);
            }
            try {
                handler = (SAMLCallbackHandler) cbClass.newInstance();
            } catch (java.lang.Exception e) {
                throw new TrustException("cannotCreatePWCBInstance", new String[]{config
                        .getCallbackHandlerName()}, e);
            }
            handler.handle(cb);
            attributes = cb.getSAML2Attributes();
            // else add the attribute with a default value
        }

        //else add the attribute with a default value
        else {
View Full Code Here

TOP

Related Classes of org.apache.rahas.impl.util.SAMLAttributeCallback

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.