Acceptance Test with Identity Server and Specflow .Net - identityserver4

I Need to test with specflow an api endpoint that has been protected with identinty server but I don't know how to do that, I've created an a WebApplication in my specflow project but when the test post a request, the response return status 500 because the API can't access .well-known/openid-configuration.

This is happening because the Auth server is not accessible during the unit test run. The API endpoint needs to validate the token against the Auth server.
What you need to do is have an auth server running separately before the unit tests (integration tests) are run.
I suspect you are attempting to run an instance of your AuthServer using something like WebApplicationFactory. This won't work because the service isn't available for the follow up call to the .well-known/openid-configuration endpoint.

Related

Need to access my angular service in protractor test cases

I am writing e2e test cases using protractor for my angular application. I have a service in my application called UserService which holds user information. I have an API getUser in this service to get the user data. I need to access UserService in my protractor test cases.
I looked at some of the articles and found that I could use browser.executeAsyncScript to access my services. But If I use this method , I am gettiing the injection issue.
In my application, the module is defined as:
var angApp = angular.module('myApp', ['ngCookies','ngResource']);
and all directives, services and controllers are created using angApp module.
Now I need to access my UserService so that I can call getUser API in my protractor testcases.
Could someone help me in accessing userService in my protractor testcases?
The problem that you are facing is that protractor tests are run in a separate process from the browser. Any script that runs in the browser is not directly accessible to your protractor tests. There is no way to directly transfer data between the two (the best you can do is interact through the DOM).
I'm guessing that your UserService is some kind of CRUD API for manipulating Users on the server. My recommendation would be to make REST requests directly from the protractor tests to the server in order to get the users. It will not be easy to share code between the tests and the app.

Do you really need a server for AngularJS app?

I want to deploy my AngularJS app which access RESTful web-services onto an aws and I am wondering if I really need a server to serve my AngularJS files.
I can server them as static files or use something like NodeJS but do I really need one?
What are the advantages/dis-advantages of using a server in this scenario?
If your app is small, it's really not a problem if you only access to an API.
But if you want to login via other services where you have for example a public and secret token it's better to work with a server who use cache this datas from your users (maybe it's what your aws is doing).
If you want to access RESTFull Web Services from AWS, you need to put your angularjs files in a server.
The server will give access to resources, if the request is from http protocol. It will deny the request to serve if the protocol is file.

Oracle ADF and SalesForce Integration

I am trying to integrate ADF application to SalesForce. I have my enterprise URL and api-token and password. I am able to call services and get results from soapUI.
Now the challenge is I'd like to integrate salesforce and get data to ADF application. I have created datacontrol for SOAP web service. But this'll not work as SalesForce follows a secured approach. First we need to call Login() service which'll return a dynamic serviceURL and a sessionId. Then we need to call the desired service with serviceURL as endpoint and sessionId as one of the request attributes. How could I implement this in declarative approach.
Please do not ask me to write a java client to access SalesForce which I already aware and I am doing.
-V
Create a Java Client Proxy for the various services you want to invoke.
Then create a class with a method that streamline calling those proxies - and expose that class as a data control to use in ADF.
Another approach is to use BPEL with the Oracle SOA suite to orchestrate the sequence of services you are calling.

Anyway to get my Jasmine tests to run against the local gae server

I'm trying to test my backbone front-end using Jasmine against our back-end API.
Our application is built on google app engine, and our build system uses maven, so I'm using the jasmine-maven-plugin to facilitate testing the front-end integration with the API.
But, when I try to run the tests, none of the REST API calls are available (which makes sense since the server jasmine spins up is solely for jasmine testing).
Does any one know of a way to get the Jasmine plug in to use the jetty server that the "gae:run" target spins up?
Because there's a ton of authenticated calls, the server that is doing the front-end testing and the API need to be the same, including port (or it would be all cross-domain requests).
Looking at the Jasmine source code for the server here: https://github.com/searls/jasmine-maven-plugin/blob/master/src/main/java/com/github/searls/jasmine/ServerMojo.java it looks like jasmine is explicitly using the jetty server directly. I don't believe that appengine gives you access to its custom jetty driver directly but you might want to look at the gae-maven-plugin source to see how they do it. You would need to write your own implementation of the ServerMojo for jasmine and plug it in there though.

RIA Authentication from a Web Services project

I have a silverlight app using RIA services. I want to reuse the RIA services component and call it from another web service. The web service and the RIA services component will be on the same server.
I have got quite far along, my web service project has a 'service reference' to the RIA services project which is all good. But when I call one of the RIA services methods I get the exception,
{DDB20766-F78A-42c7-B777-5ECF0AD9E4F3}Access to operation 'GetValidId' was denied.
at System.ServiceModel.DomainServices.Server.DomainService.ValidateMethodPermissions(DomainOperationEntry domainOperationEntry, Object entity)
The RIA services domain class has the attribute [RequiresAuthentication]. I am trying to understand how I can specify those credentials and authenticate?
Just as a test I commented out the attribute [RequiresAuthentication] and everything worked without any problems.
Check out this link:
http://www.ben-morris.com/using-the-wcf-authentication-service-without-cookies
Basically, you have to first successfully authenticate against your server, and have the server send back to you an authentication cookie that you can programatically add to subsequent requests to WCF RIA methods with [RequiresAuthentication] turned on.
Note, to get this to work, in your client program, when setting up WCF bindings to call your server WCF RIA methods, ensure allowCookies="false"; this will allow the code from the above link to actually be able to manually set the cookies in the header.

Resources