Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds a new Provider for self-hosted atlassian #35

Merged
merged 8 commits into from
Apr 24, 2017

Conversation

heiglandreas
Copy link
Contributor

@heiglandreas heiglandreas commented Mar 27, 2017

This commit adds a new provider for self-hosted attlasian-instances. It has been tested against a self-hosted confluence version 5.9.8.

Due to missing API-versioning there might be adaptions needed for general usage. Currently I only have this instance available for testing

There currently also are no tests!

In raising this pull request, I confirm the following (please check boxes):

  • I have read and understood the Contributing Guidelines.
  • I have checked that another pull request for this purpose does not exist.
  • I wrote some tests for this PR.

Small description of change:

Thanks 😺

@heiglandreas
Copy link
Contributor Author

Bugs fixed. Though no new tests… As I coudln't find some examples for other OAuth1-Providers I didn't add some…

*/
public function oauthRequest($uri, $method = Client::GET, $parameters = [])
{
error_log($uri);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Debug things should be removed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ouch! Right! :(

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That method shouldn't be there in the first place as it is obsoleted by #36


public function __construct($private_key)
{
if (! is_readable($private_key)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unexpected spaces

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where?


class MethodRSASHA1 extends AbstractSignatureMethod
{
private $private_key;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not camelCase

Copy link
Contributor Author

@heiglandreas heiglandreas Mar 31, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Editing…

*/
protected $signature;


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unneeded blank line

<?php
/**
* SocialConnect project
* @author: Patsura Dmitry https://github.com/ovr <talk@dmtry.me>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you @author

*/
public function __construct(ClientInterface $httpClient, SessionInterface $session, Consumer $consumer, array $parameters)
{
if (! isset($parameters['baseUri'])) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (! i -> if (!i - please remove unneeded space


class Atlassian extends AbstractProvider
{
private $baseUri;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blank line after private $baseUri;
and please doc block that it's a string
Thank

);
}

$headers = $response->getHeader('X-AUSERNAME');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$headers is unused, please remove it, thanks

Client::GET,
$parameters
);
while ($response->hasHeader('Location')) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

plank line before while
and btw, this while can be an infinity loop
if you are sure that attlasin can lag, maybe add retryCount, and retryMax? Thank

<?php
/**
* SocialConnect project
* @author: Patsura Dmitry https://github.com/ovr <talk@dmtry.me>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You @author


public function __construct($privateKey)
{
if (! is_readable($privateKey)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (! is_readable($privateKey)) - please remove uneeded space
Thank


class MethodRSASHA1 extends AbstractSignatureMethod
{
private $privateKey;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docblock that it's string?

throw new \InvalidArgumentException('The private key is not readable');
}

if (! function_exists('openssl_pkey_get_private')) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (! function_exists('openssl_pkey_get_private')) { - please remove unneeded space
Thank

@@ -0,0 +1,75 @@
<?php
/**
* Copyright (c) Andreas Heigl<andreas@heigl.org>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not a SocialConnect LICENSE header

@@ -0,0 +1,83 @@
<?php
/**
* Copyright (c) Andreas Heigl<andreas@heigl.org>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, not SociallConnect LICENSE header

@ovr
Copy link
Member

ovr commented Apr 8, 2017

@heiglandreas I added small comments, if you can fix this will be cool
and after it this can merged!
Thank

This commit adds a new provider for self-hosted attlasian-instances. It
has been tested against a self-hosted confluence version 5.9.8.

Due to missing API-versioning there might be adaptions needed for
general usage. Currently I only have this instance available for testing

Ther ecurrently also are *no* tests!
These mainly include removing whitespace and adding dockblocks
@heiglandreas
Copy link
Contributor Author

All your comments should be addressed by now. Thanks for the feedback!

*
* Required configuration parameters are:
*
* * base_uri The base URI of your self-hosted atlassian product
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In code the key is baseUri not base_uri.

* Required configuration parameters are:
*
* * base_uri The base URI of your self-hosted atlassian product
* * private_key The path to the private key file used for signing.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this correct? A quick search doesn't show any use of $parameters['private_key'] in the code.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for spotting!!! I'll check that!!

This commit fixes the docblock describing the config-parameters
@ovr ovr merged commit 1f0db0f into SocialConnect:master Apr 24, 2017
@ovr
Copy link
Member

ovr commented Apr 24, 2017

BIG Thank @heiglandreas Awesome! Take it 🍺
Thank @ADmad for review

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.

3 participants