How do you create 2-Legged Impersonating OAuth ApplicationLinks with Java API?

I've been using the MutatingApplicationLinkService for some time to programatically create ApplicationLinks in tests using Trusted authentication.

Along these lines:

ApplicationLink applicationLink = applicationLinkService.createApplicationLink(type, details);
applicationLinkService.createReciprocalLink(uri, null, username, password);
applicationLinkService.configureAuthenticationForApplicationLink(applicationLink, TRUSTED_COMMON_USERS, username, password);

where:

AuthenticationScenario TRUSTED_COMMON_USERS = new AuthenticationScenario() {
        public boolean isCommonUserBase() {
            return true;
        }

        public boolean isTrusted() {
            return true;
        }
    };

But now Trusted auth has been deprecated in favour of 2-legged oauth, so have the methods createReciprocalLink and configureAuthenticationForApplicationLink. Without any indication of what to replace them with.

I've tried experimenting by doing this instead on each App:

ApplicationLink applicationLink = applicationLinkService.createApplicationLink(type, details);

authenticationConfigurationManager.registerProvider(applicationLink.getId(), OAuthAuthenticationProvider.class, ImmutableMap.of());
authenticationConfigurationManager.registerProvider(applicationLink.getId(), TwoLeggedOAuthAuthenticationProvider.class, ImmutableMap.of());
authenticationConfigurationManager.registerProvider(applicationLink.getId(), TwoLeggedOAuthWithImpersonationAuthenticationProvider.class, ImmutableMap.of());

But that only sets up outbound auth on each app, it doesn't permit inbound 2-legged impersonating oauth on the apps.

I can't find any public API to enable this - the APIs used by the AppLinks plugin UI resources appear to use internal private APIs (com.atlassian.applinks.internal.status.oauth.OAuthStatusService#updateOAuthStatus).

Can anyone, or Atlassian even, shed light on how to accomplish this programmatically?

 

1 answer

0 vote
Sam Hall Community Champion Apr 21, 2017

Hi Mark - it might be worth asking this over at: https://community.developer.atlassian.com as well (if you haven't already).

You can read more about the Developer Community in this article: https://community.atlassian.com/t5/Feedback-Forum-articles/The-Atlassian-Developer-Community/ba-p/459061

Oh yes, i forgot there was that, with all this 'community' migration farce! Cheers for the reminder.

It's a shame i can't just move it!

 

https://community.developer.atlassian.com/t/how-do-you-create-2-legged-impersonating-oauth-applicationlinks-with-java-api/2891

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Monday in Jira Software

How large do you think Jira Software can grow?

Hi Atlassian Community! My name is Shana, and I’m on the Jira Software team. One of the many reasons this Community exists is to connect you to others on similar product journeys or with comparabl...

418 views 6 10
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you