Giter Site home page Giter Site logo

Comments (4)

solvingj avatar solvingj commented on September 13, 2024

Similar issue with Result.Map and Result.OnSuccess overloads. Rolling back to 1.7.1 fixes. Also adding this overload locally fixes Map, the OnSuccess equivalent probably fixes it as well:

        public static async Task<Result<K>> Map<T, K>(this Result<T> result, Func<T, Task<K>> func, bool continueOnCapturedContext = false)
        {
            if (result.IsFailure)
                return Result.Fail<K>(result.Error);

            K value = await func(result.Value).ConfigureAwait(continueOnCapturedContext);

            return Result.Ok(value);
        }

Again, I'm confused because i re-forked and found the overloads exist in the source code on the master branch. They just won't resolve from my project on 1.8.1. Any ideas?

from csharpfunctionalextensions.

vkhorikov avatar vkhorikov commented on September 13, 2024

@solvingj Could you post the full source code? I'll try to figure out what's wrong

from csharpfunctionalextensions.

solvingj avatar solvingj commented on September 13, 2024

Sorry, refactored out many commits ago :(

I will try to create a reproduction later tonight .

from csharpfunctionalextensions.

solvingj avatar solvingj commented on September 13, 2024

I'm not sure if it helps , but here is the code...

Note that AuthenticationContext comes from Microsoft.IdentityModel.Clients.ActiveDirectory

using Microsoft.IdentityModel.Clients.ActiveDirectory;

....

        public async Task<Result<AuthenticationResult>> AcquireTokenAsync(
            AuthenticationContext context, string resource)
        {
            if (await GetAuthTypeAsync() == AuthenticationType.CERTIFICATE.ToString())
            {
                return await GetClientAssertionCertificate()
                    .OnSuccess(certificate => AcquireTokenAsync(context, resource, certificate));
            }
            else
            {
                return await GetClientCredential()
                    .OnSuccess(credential => AcquireTokenAsync(context, resource, credential));
            }
        }
        public async Task<Result<ClientCredential>> GetClientCredential()
        {
            Result<string> clientId = await GetClientIdAsync();
            Result<string> clientSecret = await GetClientSecretAsync();
            return Result.Combine(clientId, clientSecret)
                    .OnSuccess(() => new ClientCredential(clientId.Value, clientSecret.Value));
        }

        public async Task<AuthenticationResult> AcquireTokenAsync(
            AuthenticationContext context, string resource, IClientAssertionCertificate certificate)
        {

            return await context.AcquireTokenAsync(resource, certificate);
        }

        public async Task<AuthenticationResult> AcquireTokenAsync(
            AuthenticationContext context, string resource, ClientCredential credential)
        {
            return await context.AcquireTokenAsync(resource, credential);
        }

from csharpfunctionalextensions.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.