Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6370501
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T00:56:16+00:00 2026-05-25T00:56:16+00:00

Assume a blackboard type application. There are 2 Projects – ProjectA and ProjectB. User

  • 0

Assume a blackboard type application. There are 2 Projects – ProjectA and ProjectB. User ‘nupul’ (me) is part of both projects. For A I’m an admin and for B I’m just a ‘member’ (no admin rights)

When accessing the resource at /MySite/ProjectA/Items I want to check if the user is an admin or not.

I know it can be simply done by picking out the {projectName} parameter from the request and using the identifier (of the user making the request) and forwarding that to check against a DB etc.,

My question is ‘how’ can I add the roles using an Enroler ‘during’ authentication itself. Since I don’t have access to the {projectName} parameter at that stage. I don’t know if you have to use Groups/Realms etc., to make this work, but honestly it’s just taking me tooooooooooooooooooo long to even understand how to effectively use this? (i.e., before the request is forwarded to the resource)

I mean I know I can create these groups/realms but how do I access the correct ‘role’ from the resource???? Restlet seriously needs to have more realistic examples and a much better documentation showing the use of it’s classes!! It’s driving me insane!! Authentication shouldn’t be THIS DIFFICULT! 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T00:56:17+00:00Added an answer on May 25, 2026 at 12:56 am

    The way to do what you want is to split your routers basing on project name within your application (method createInboundRoot). In this case, the projectname will be evaluated before calling the authenticator. See below some examples of implementing such approach:

    public Restlet createInboundRoot() {
        Router rootRouter = new Router(getContext());
        rootRouter.setDefaultMatchingMode(Template.MODE_STARTS_WITH);
    
        rootRouter.attach("/{projectname}/", createApplicationForProject());
        return rootRouter;
    }
    
    private Restlet createApplicationForProject() {
        Router router = new Router(getContext());
    
        ChallengeAuthenticator guard
                 = new ChallengeAuthenticator(getContext(),
                            ChallengeScheme.HTTP_BASIC, "realm");
        guard.setVerifier(verifier);
        guard.setEnroler(enroler);
        guard.setNext(router);
    
        router.attach("items", ItemsServerResource.class);
        return guard;
    }
    

    Using such approach, you’ll have access to the value of the projectname variable within the verifier and be able to use it in the authentication processing.

    Hope it helps you,
    Thierry

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Assume there are two models: User and Question . I can use @OneToMany to
Assume that we have N erlang nodes, running same application. I want to share
Assume I have created a compiled re: x = re.compile('^\d+$') Is there a way
Assume there is a dynamic project. I have a file e.g. FileX under the
Assume there is a file test.txt containing a string 'test' . Now, consider the
Assume I have generic list L of some type in c#. Then, using linq,
Assume I have a static generic class. Its generic type parameters are not available
Assume the following mapping entries: < class name=Customer table=customer> <id name=InternalId column=uintCustomerId type=long> <generator
Assume I have the following: <input type=text> <div id=listofstuff> <div class=anitem> <span class=item name>Dog</span>
Assume there's an XMLBeans XmlObject with attributes, how can I get selected attributes in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.