GithubHelp home page GithubHelp logo

Comments (4)

cdanger avatar cdanger commented on August 19, 2024

The type argument of your AttributeProvider factory must extend AbstractAttributeProvider indeed. In your AttributeProvider's XML schema (that defines the AttributeProvider's configuration model or format if you will), there must be a XML type that extends AbstractAttributeProvider (namespace http://authzforce.github.io/xmlns/pdp/ext/3), like TestAttributeProvider (namespace http://authzforce.github.io/core/xmlns/test/3) for example. As a result, the maven-jaxb2-plugin in your POM will generate a JAXB-annotated class from it (during the generate-sourcesphase of the build with Maven) which extends org.ow2.authzforce.xmlns.pdp.ext.AbstractAttributeProvider (also JAXB-annotated class corresponding to XML type AbstractAttributeProvider). For example, the class org.ow2.authzforce.core.pdp.testutil.ext.xmlns.TestAttributeProvider is generated from XML type TestAttributeProvider (during the build of pdp-testutils module). This JAXB-annotated class is the one you must use as type argument. So please check the JAXB classes generated (run maven generate-sources), one of them must extend AbstractAttributeProvider.

Use the TestAttributeProvider source code (for your version of authzforce-ce-core) as ultimate reference, if the doc is confusing or not up-to-date. Indeed, some class names were not up-to-date with the latest API:

  • CloseableDesignatedAttributeProvider renamed to CloseableNamedAttributeProvider
  • BaseDesignatedAttributeProvider renamed to BaseNamedAttributeProvider

Thanks for reporting that, I fixed the wiki page. Sorry for the confusion :-( .

from core.

miladamery avatar miladamery commented on August 19, 2024

thank you for answering but i still don't get it. in TestAttributeProvider class which is for reference we have

public class TestAttributeProvider extends BaseNamedAttributeProvider { ... }

and the factory class is like :

public static class Factory extends CloseableNamedAttributeProvider.FactoryBuilder<org.ow2.authzforce.core.pdp.testutil.ext.xmlns.TestAttributeProvider>
{
...
}

(what is that xmlns package? TestAttributeProvider package is org.ow2.authzforce.core.pdp.testutil.ext )
according to wiki this should work but it won't because BaseNamedAttributeProvider is not extended from AbstractAttributeProvider.
then according to what you answered something like

public class TestAttributeProvider
    extends AbstractAttributeProvider implements CloseableNamedAttributeProvider { ... }

and using this type in factory will work. this is different from what wiki and reference TestAttributeProvider says.

from core.

cdanger avatar cdanger commented on August 19, 2024

As I said, the class ....xmlns.TestAttributeProvider - and so the xmlns package you are refering to - is generated automatically by Maven during the build. You will NOT find it anywhere in authzforce source code, because it is generated source code. This is different from the class ....ext.TestAttributeProvider (different package!). The one in the xmlns package is your XML type mapped to Java (using JAXB), it is automatically generated by maven-jaxb2-plugin, and only represents the configuration parameters to your Attribute Provider. (Maybe we should name it TestAttributeProviderConfiguration to make the difference less subtle.) The other one is a class that must be written by you to implement the actual Attribute Provider's logic (retrieving the attribute(s)).

So, again, what you should do first, is run $ mvn generate-sources as told on the wiki; make sure some Java classes are generated by this command (based on your XML schema). They should end up in target/generated-sources/xjc usually or something like that. In any case, they should be automatically added to the build path. Finally, make sure that one of these generated class extends AbstractAttributeProvider. Let me know what class is there. It will be the type arg to your factory.

We don't mention BaseNamedAttributeProvider yet at this point, this is for the AttributeProvider's logic implementation.

from core.

miladamery avatar miladamery commented on August 19, 2024

thank you for answering. i think now i get it now. i was confused because of the same class names. i'm going to try again for creating custom attribute provider.

from core.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.