Skip to content

Conversation

@jekstrom
Copy link

@jekstrom jekstrom commented Jul 2, 2018

I needed the ability to sign with RSA-SHA1 for interacting with Jira, so I modified this to handle that signing method.

@nitzel
Copy link

nitzel commented Aug 15, 2018

Awesome, thank you! Would be great to have it merged and in the .nuget package, too.

@jekstrom
Copy link
Author

jekstrom commented Oct 2, 2018

I created a new repo and published this to NuGet:
https://github.com/jekstrom/SmallOauth1
https://www.nuget.org/packages/SmallOauth1/

Please let me know if this works for you, since this project does not seem active any more.

@nitzel
Copy link

nitzel commented Oct 11, 2018

@jekstrom Thanks for taking the ownership here! The nuget package works mostly fine for me.
What bugs me is that the code in the nuget package is not the same as in your master branch (NotImplementedExceptions).

For the oauth_callback to work with JIRA, you have to completely omit(sic!) it in GetRequestTokenAsync and then append it to the url as you did in GetAuthorizationUrl.

As strings are a code smell I'd convert them to Uris where possible and use an enum for the signature method. I've used a slightly incorrect string way too many times:

    public enum SignatureMethod
    {
        HMAC_SHA1,
        RSA_SHA1,
        PLAINTEXT
    }

    public static class ExtensionMethods
    {
        public static string MapToString(this SignatureMethod signatureMethod)
        {
            switch (signatureMethod)
            {
                case SignatureMethod.HMAC_SHA1:
                    return "HMAC-SHA1";
                case SignatureMethod.RSA_SHA1:
                    return "RSA-SHA1";
                case SignatureMethod.PLAINTEXT:
                    return "PLAINTEXT";
                default:
                    throw new ArgumentException(nameof(signatureMethod));
            }
        }
    }

As soon as you've got your master branch up to date with the nuget package and an automated way of publishing to .NuGet I'd be happy to contribute these changes to your repository!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants