private boolean addonUsesSymmetricSharedSecret(AuthenticationType authType, SigningAlgorithm algorithm) { return AuthenticationType.JWT.equals(authType) && algorithm.requiresSharedSecret(); }
private static boolean addonRequiresAuth(AuthenticationBean authType) { return authType != null && !AuthenticationType.NONE.equals(authType.getType()); }
private boolean addonUsesSymmetricSharedSecret(AuthenticationType authType, SigningAlgorithm algorithm) { return AuthenticationType.JWT.equals(authType) && algorithm.requiresSharedSecret(); }
private RemotablePluginAccessor create(String addonKey, String addonName, Supplier<URI> displayUrl, Optional<AuthenticationType> authenticationType, Supplier<ShallowConnectAddon> addon) { if(authenticationType.isPresent()) { if (AuthenticationType.JWT.equals(authenticationType.get())) { return new JwtSigningRemotablePluginAccessor(addon.get(), displayUrl, jwtBuilderFactory, jwtService, consumerService, httpContentRetriever, connectAddonRegistry); } else if (AuthenticationType.NONE.equals(authenticationType.get())) { return new NoAuthRemotablePluginAccessor(addonKey, addonName, displayUrl, httpContentRetriever); } } throw new IllegalStateException("No valid authentication method found for " + addonName + ".\nThis was probably caused by a data restore from a different instance.\n" + "Please refer this instance to the Atlassian Connect developer on support for remediation.\n" + "DO NOT simply re-install the affected add-ons; this can cause data loss for some add-ons.\n" + "See https://ecosystem.atlassian.net/browse/AC-1528"); } }
@Override public Optional<String> getSharedSecretOrPublicKey(ApplicationLink applink) { Optional<AuthenticationType> maybeAuthType = ConnectApplinkUtil.getAuthenticationType(applink); if (maybeAuthType.isPresent()) { if (maybeAuthType.get().equals(AuthenticationType.JWT)) { Object prop = applink.getProperty(JwtConstants.AppLinks.SHARED_SECRET_PROPERTY_NAME); if (prop instanceof String) { return Optional.of((String) prop); } } } return Optional.empty(); }
private RemotablePluginAccessor create(String addonKey, String addonName, Supplier<URI> displayUrl) { Optional<AuthenticationType> authenticationType = connectAddonInformationProvider.getAuthenticationType(addonKey); if(authenticationType.isPresent()) { if (AuthenticationType.JWT.equals(authenticationType.get())) { ConnectAddonBean addon = addonAccessor.getAddon(addonKey).get(); return new JwtSigningRemotablePluginAccessor(addon, displayUrl, jwtBuilderFactory, jwtService, consumerService, httpContentRetriever, connectAddonInformationProvider); } else if (AuthenticationType.NONE.equals(authenticationType.get())) { return new NoAuthRemotablePluginAccessor(addonKey, addonName, displayUrl, httpContentRetriever); } } throw new IllegalStateException("No valid authentication method found for " + addonName + ".\nThis was probably caused by a data restore from a different instance.\n" + "Please refer this instance to the Atlassian Connect developer on support for remediation.\n" + "DO NOT simply re-install the affected add-ons; this can cause data loss for some add-ons.\n" + "See https://ecosystem.atlassian.net/browse/AC-1528"); }
private static boolean addonUsesJwtAuthentication(ShallowConnectAddonBean addon) { return null != addon.getAuthentication() && AuthenticationType.JWT.equals(addon.getAuthentication().getType()); }
private static boolean addonRequiresAuth(ConnectAddonBean addon) { return addon.getAuthentication() != null && !AuthenticationType.NONE.equals(addon.getAuthentication().getType()); }
private static boolean addonUsesJwtAuthentication(ConnectAddonBean addon) { return null != addon.getAuthentication() && AuthenticationType.JWT.equals(addon.getAuthentication().getType()); }