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 8433959
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T06:31:43+00:00 2026-06-10T06:31:43+00:00

I have an OSGi bundle which is deployed into Apache Karaf 2.2.8 . In

  • 0

I have an OSGi bundle which is deployed into Apache Karaf 2.2.8. In this bundle I am using CXF and Camel routes. I written a CXF interceptor which does the basic authentication: takes all existing users from database and does validation.

The problem is when the method handleMessage is called, the AuthorizationPolicy object is null. It does not provides any credentials. Here is my code:

@Override
public void handleMessage(Message message)
        throws Fault {
        AuthorizationPolicy policy = message.get(AuthorizationPolicy.class);
    if (users == null) {
        setLastAccessedTime(Calendar.getInstance());
    }
    if (!wasRecentlyAccessed()) {
        users = this.loadUsers();
        setLastAccessedTime(Calendar.getInstance());
    }
    for (String user : users.values()) {
        LOGGER.debug("Existing user: " + user);
    }
    if (policy == null) {
        LOGGER.error("User attempted to log in with no credentials");
        sendErrorResponse(message, HttpURLConnection.HTTP_UNAUTHORIZED);
        return;
    }
    String password = users.get(policy.getUserName());
    if (password == null || !policy.getPassword().equals(password)) {
        LOGGER.error("Invalid login authentication for user: " + policy.getUserName());
        sendErrorResponse(message, HttpURLConnection.HTTP_FORBIDDEN);            
    }
}

Is there anyway I can set up the basic authentication parameters in Karaf for the specific endpoint? Is there is some kind of configuration file or something? I can not find anything on the internet…

  • 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-06-10T06:31:45+00:00Added an answer on June 10, 2026 at 6:31 am

    Take a look here: https://access.redhat.com/documentation/en-US/Fuse_ESB_Enterprise/7.1/html/Security_Guide/files/CamelJetty-BasicAuth.html

    It is explained very clear how to make basic authentication work with Apache Karaf and Camel Jetty. Later you can use it on every bundle deployed in your Apache Karaf.

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

Sidebar

Related Questions

I have an OSGi bundle deployed on Apache Karaf . I have a simple
Which maven plugin is used for building an osgi bundle containing camel-routes and some
I have written this OSGI bundle: /* * To change this template, choose Tools
have written this little class, which generates a UUID every time an object of
I have an Eclipse plugin for which I create the OSGi bundle JARs with
I am using the aQute Bnd toolset to create an OSGi bundle and have
I have an OSGi bundle which is in Eclipse IDE represented as Eclipse Plug-in
I want to implement OSGI bundle which can write error messages into log file.
I try to learn how osgi works. I've written my first hello-world bundle which
How is the OSGi bundle start level defined? I am using Apache felix and

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.