Code Monkey home page Code Monkey logo

Comments (5)

zimmski avatar zimmski commented on July 18, 2024

Ok I got it, maybe you can add an example:

block, _ := pem.Decode([]byte(keyRSAPrivate))
privateKey, err := x509.ParsePKCS1PrivateKey(block.Bytes)
if err != nil {
    ...
}

And then for Jira use the following configuration

c := oauth.NewRSAConsumer(
    keyConsumer,
    privateKey,
    oauth.ServiceProvider{
        RequestTokenUrl:   jiraURL + "/plugins/servlet/oauth/request-token",
        AuthorizeTokenUrl: jiraURL + "/plugins/servlet/oauth/authorize",
        AccessTokenUrl:    jiraURL + "/plugins/servlet/oauth/access-token",
        HttpMethod:        "POST",
    },
)

Since we use a self signed certificate I also just ignore the verification:

c.HttpClient = &http.Client{
    Transport: &http.Transport{
        TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
    },
}

from oauth.

mrjones avatar mrjones commented on July 18, 2024

Hey cool, thanks for figuring this out. I actually haven't used the RSASHA1 signatures before (someone else added them) so this is neat to see.

I'd love to use this in an example ... only, after a brief search, I couldn't seem to find many (or any really) OAuth service providers that use RSASHA1 signatures. Google has a few that seem to work this way, but they claim to be shutting down all the OAuth 1.0 endpoints soon, so such an example would quickly become obsolete.

Do you have an example site in mind that we could use as the basis for an example?

from oauth.

zimmski avatar zimmski commented on July 18, 2024

I think that an example for an imaginable Jira instance is just fine since all Atlassian products only support Oauth 1. Here is some documentation on this https://bitbucket.org/atlassian_tutorial/atlassian-oauth-examples I think it is OK to use the code from my comment before and let people just set the jiraURL variable to the URL of their instance e.g. "https://jira.atlassian.com" for the official public Atlassian Jira instance. You can basically pick any Atlassian service or any project which is using something from Atlassian but the problem is that you need access to the administration to add an "application link" to register the public key.

from oauth.

mrjones avatar mrjones commented on July 18, 2024

Ok, I created a jira example:

https://github.com/mrjones/oauth/blob/master/examples/jira/jira.go

I couldn't easily find a Jira project where I could be an administrator to add the Application Links you mentioned, so for now this will just have to be un-tested. Which means it's almost certainly broken in some way :)

If you have a Jira instance that you can access, feel free to test it out, and let me know if it works. If it's broken, I can try to fix it or I'd be happy to accept a pull request.

Thanks again for your help!

  • Matt

from oauth.

zimmski avatar zimmski commented on July 18, 2024

I fixed the REST API URL with #28 but other than that it works fine with our Jira instance.

from oauth.

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.