Esempio n. 1
0
 static PlainSingletonUseCase()
 {
     var logger = new Logger();
     var errorHandler = new ErrorHandler(logger);
     var database = new Database(logger, errorHandler);
     stockQuote = new StockQuote(logger, errorHandler, database);
     authenticator = new Authenticator(logger, errorHandler, database);
 }
Esempio n. 2
0
    // Gets the required token to next calls.
    public static void Login(HttpClient httpClient)
    {
        // Creates a authenticator instance.
        var authenticator = new Domain.Authenticator(httpClient);

        // Gets a token to next calls.
        var token = authenticator.Login().Result as Token;

        // Adds the Authorization header to the http client.
        var authorization = new AuthenticationHeaderValue("Bearer", token.AccessToken);

        httpClient.DefaultRequestHeaders.Authorization = authorization;
    }