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

The Archive Base Latest Questions

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

I have developed a REST application server based on RESTEasy (JAX-RS). I have a

  • 0

I have developed a REST application server based on RESTEasy (JAX-RS).

I have a set of unit tests for each service based on org.jboss.resteasy.mock.MockDispatcherFactory. These mock out the database calls so that I can return “canned” database responses.

Everything worked well until I added security code that checked the DIGEST Principal (java.security.Principal). I wrote a security interceptor that expects to retrieve the user identity of the user calling the service and verify that this user has authorization to execute the service.

I can’t find any way to send in a mock Principal.

Short of disabling my security checks in my unit tests, is there any way to tell the mock server to use a mock Principal? I would rather NOT disable the security, because that is part of what I want to test.

  • 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-01T06:43:01+00:00Added an answer on June 1, 2026 at 6:43 am

    I would use Mockito. Mockito enables you to mock call to any method, so it is quite easy to produce “fake”, fabricated by you, Principal object. See this example or google “java.security.Principal mocking with mockito” for more examples.

    I hope this would help, since I am not 100% sure you can apply such method in your case.

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

Sidebar

Related Questions

I have developed a web service and host it on my server and I
I have developed a sample WCF REST service that accepts that creates an Order
I have developed REST WCF and set binding following way in web.config <bindings> <webHttpBinding>
I have developed a window application in VS2005 using C#. I need to integrate
I have developed an application in ASP.NET 3.5 which utilizes the Membership and Roles
I am using Silverlight to interact with a proxy application that I have developed
I have an existing, fully functional Spring web application based on Spring 2.5.6 -
I have developed one WCF application, and it is working as a middle layer
I have developed an iPhone application that fetches data from internet. I want to
We currently have developed an application using WCF. Our clients make connections to different

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.