This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to add basic authentication to the REST Virtual Service in 5.4.1

Hi Team,

May I know how to add the Basic authentication (username/password) in the REST Virtual Service.

MF SV Version: 5.4.1

Example: currently I have virtual service deployed in standalone sv server, the endpoint is open to all and anyone can send the request.

I would like to set the authentication/set security to my virtual service so than only people who have proper identity/ credentials can send the request to my virtual service.

Request your support.

   

  • 0

    The Security Settings in the virtual service applies only towards the real service, so you are able to learn or pass the traffic to it in Standby.

    If you want to return different response for different users, you would need to handle everything manually in a data model.

  • 0 in reply to 

    Hi  , 

    Thanks,

    Could you please explain details, how do I handle these use case manually in data model? 

  • Verified Answer

    +1   in reply to 

    Hi,

    I assume you need this behavior in simulation:

    On your virtual service main page if you go to the Service Description section, you can add the Authorization header in the metadata section. This will make this header visible in the data model. In case of basic authentication, the authorization header has the username and password base64 encoded like shown here https://mixedanalytics.com/tools/basic-authentication-generator/ . You can set condition functions on this column and in that case it will only match if the value matches what you speficied in your data model. If you need more information on data modeling in general have a look at https://github.com/MicroFocus/sv-trainings

    Regards

    Karel