Package org.apache.rahas.impl.util

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


                    .asList(confirmationMethods), null, keyInfoElem);

          
            SAMLAttribute[] attrs = null;
            if(config.getCallbackHander() != null){
              SAMLAttributeCallback cb = new SAMLAttributeCallback(data);
              SAMLCallbackHandler handler = config.getCallbackHander();
              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


                    .asList(confirmationMethods), null, keyInfoElem);

          
            SAMLAttribute[] attrs = null;
            if(config.getCallbackHander() != null){
              SAMLAttributeCallback cb = new SAMLAttributeCallback(data);
              SAMLCallbackHandler handler = config.getCallbackHander();
              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

        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

                                                                SAMLTokenIssuerConfig config)
            throws TrustException {
        try {
            SAMLAttribute[] attrs = null;
            if (config.getCallbackHandler() != null) {
                SAMLAttributeCallback cb = new SAMLAttributeCallback(rahasData);
                SAMLCallbackHandler handler = config.getCallbackHandler();
                handler.handle(cb);
                attrs = cb.getAttributes();
            } else if (config.getCallbackHandlerName() != null
                       && config.getCallbackHandlerName().trim().length() > 0) {
                SAMLAttributeCallback cb = new SAMLAttributeCallback(rahasData);
                SAMLCallbackHandler handler = null;
                MessageContext msgContext = rahasData.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 (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,
View Full Code Here

    Attribute[] attributes = null;

    // Call the attribute callback handlers to get any attributes if exists
    if (config.getCallbackHander() != null) {
      SAMLAttributeCallback cb = new SAMLAttributeCallback(data);
      SAMLCallbackHandler handler = config.getCallbackHander();
      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 {
      SAMLObjectBuilder<Attribute> attrBuilder = (SAMLObjectBuilder<Attribute>) builderFactory
          .getBuilder(Attribute.DEFAULT_ELEMENT_NAME);
      Attribute attribute = attrBuilder.buildObject();
View Full Code Here

                    .asList(confirmationMethods), null, keyInfoElem);

          
            SAMLAttribute[] attrs = null;
            if(config.getCallbackHander() != null){
              SAMLAttributeCallback cb = new SAMLAttributeCallback(data);
              SAMLCallbackHandler handler = config.getCallbackHander();
              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

    private static Log log = LogFactory.getLog(AttributeCallbackHandler.class);
    protected Map<String, RequestedClaimData> requestedClaims = new HashMap<String, RequestedClaimData>();
    protected Map<String, Claim> supportedClaims = new HashMap<String, Claim>();

    public void handle(SAMLCallback callback) throws SAMLException {
        SAMLAttributeCallback attrCallback = null;
        RahasData data = null;
        OMElement claimElem = null;
        String userIdentifier = null;
        IdentityAttributeService[] attributeCallbackServices = null;

        try {
            if (callback instanceof SAMLAttributeCallback) {
                attrCallback = (SAMLAttributeCallback) callback;
                data = attrCallback.getData();
                claimElem = data.getClaimElem();
                userIdentifier = data.getPrincipal().getName();
                loadClaims(userIdentifier);
                processClaimData(data, claimElem);
                populateClaimValues(userIdentifier, attrCallback);

                if (RahasConstants.TOK_TYPE_SAML_20.equals(data.getTokenType())) {
                    if (attrCallback.getSAML2Attributes() == null
                            || attrCallback.getSAML2Attributes().length == 0) {
                        attrCallback.addAttributes(getSAML2Attribute("Name", "Colombo",
                                "https://rahas.apache.org/saml/attrns"));
                    }
                } else {
                    if (attrCallback.getAttributes() == null
                            || attrCallback.getAttributes().length == 0) {
                        SAMLAttribute attribute = new SAMLAttribute("Name",
                                "https://rahas.apache.org/saml/attrns", null, -1, Arrays
                                        .asList(new String[]{"Colombo/Rahas"}));
                        attrCallback.addAttributes(attribute);
                    }
                }

                attributeCallbackServices = IdentityAttributeServiceStore.getAttributeServices();
                for (int i = 0; i < attributeCallbackServices.length; i++) {
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

                                                                SAMLTokenIssuerConfig config)
            throws TrustException {
        try {
            SAMLAttribute[] attrs = null;
            if (config.getCallbackHandler() != null) {
                SAMLAttributeCallback cb = new SAMLAttributeCallback(rahasData);
                SAMLCallbackHandler handler = config.getCallbackHandler();
                handler.handle(cb);
                attrs = cb.getAttributes();
            } else if (config.getCallbackHandlerName() != null
                       && config.getCallbackHandlerName().trim().length() > 0) {
                SAMLAttributeCallback cb = new SAMLAttributeCallback(rahasData);
                SAMLCallbackHandler handler = null;
                MessageContext msgContext = rahasData.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 (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,
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.