[Bps-public-commit] rt-extension-assets-applegsx branch uat updated. 1.0-24-g5b5b500
BPS Git Server
git at git.bestpractical.com
Wed Jan 19 13:27:03 UTC 2022
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "rt-extension-assets-applegsx".
The branch, uat has been updated
via 5b5b500a3de05de0ae1dec1a61b86c71632fadc0 (commit)
via e1e5994fdc324904fb5275c6475785d5d4f3a4d6 (commit)
via c3e98db51b7691a80572727948e55629f2123ea1 (commit)
via 3562e876f1592f3e8deb3a1c96c28691d652926e (commit)
via 77e2ab64c1ca6ab2cdff6bb68e9f749bc44fb60e (commit)
via 46da73c02383f4de5acccc577b196e1702289446 (commit)
via 408740d992c91eb997ce3c930ff826d9fc119e28 (commit)
via 09c95810fe82cba48ad896a772db3e2b4f432f0d (commit)
via 90f9927555f3435ed2d53e8828020661f476a9ce (commit)
via e7601a4da1377380272b86f89e047d9d57c59001 (commit)
from 8f84a04394f65046295a0d9e5847126dc99687ea (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 5b5b500a3de05de0ae1dec1a61b86c71632fadc0
Author: Jim Brandt <jbrandt at bestpractical.com>
Date: Fri Aug 6 10:24:41 2021 -0400
Version 2.04
diff --git a/Changes b/Changes
index 6ec9fba..cf8f3bc 100644
--- a/Changes
+++ b/Changes
@@ -1,5 +1,11 @@
Revision history for RT-Extension-Assets-AppleGSX
+2.04 2021-08-06
+
+ - Update auth calls to use /api, other calls to use /api/gsx. Note
+ this also updates the suggested setting for $AppleGSXApiBase to set
+ just the base URL.
+
2.03 2021-07-30
- Add debug logs to auth phase
diff --git a/META.yml b/META.yml
index 23e0d60..ea2351e 100644
--- a/META.yml
+++ b/META.yml
@@ -30,6 +30,6 @@ requires:
perl: 5.8.3
resources:
license: http://opensource.org/licenses/gpl-license.php
-version: '2.03'
+version: '2.04'
x_module_install_rtx_version: '0.42'
x_requires_rt: 4.0.0
diff --git a/lib/RT/Extension/Assets/AppleGSX.pm b/lib/RT/Extension/Assets/AppleGSX.pm
index ab33519..fddeb6b 100644
--- a/lib/RT/Extension/Assets/AppleGSX.pm
+++ b/lib/RT/Extension/Assets/AppleGSX.pm
@@ -3,7 +3,7 @@ use warnings;
package RT::Extension::Assets::AppleGSX;
use RT::Extension::Assets::AppleGSX::Client;
-our $VERSION = '2.03';
+our $VERSION = '2.04';
my $CLIENT;
my $CLIENT_CACHE;
commit e1e5994fdc324904fb5275c6475785d5d4f3a4d6
Author: Jim Brandt <jbrandt at bestpractical.com>
Date: Fri Aug 6 10:20:51 2021 -0400
Update to use different endpoint for auth and non-auth
New guidance indicates authentication calls should go
to /api and all other calls should go to /api/gsx.
diff --git a/README b/README
index 89be1e3..98d3a43 100644
--- a/README
+++ b/README
@@ -44,13 +44,13 @@ CONFIGURATION
The configuration for the service uses the following variables:
# test server
- Set( $AppleGSXApiBase, 'https://partner-connect-uat.apple.com/gsx/api');
+ Set( $AppleGSXApiBase, 'https://partner-connect-uat.apple.com');
Set( $AppleGSXGetToken, 'https://gsx2-uat.apple.com/gsx/api/login');
or
# production server
- Set( $AppleGSXApiBase, 'https://partner-connect.apple.com/gsx/api');
+ Set( $AppleGSXApiBase, 'https://partner-connect.apple.com');
Set( $AppleGSXGetToken, 'https://gsx2.apple.com/gsx/api/login');
Once you have done this, you can configure the authentication
diff --git a/lib/RT/Extension/Assets/AppleGSX.pm b/lib/RT/Extension/Assets/AppleGSX.pm
index 0e32f6a..ab33519 100644
--- a/lib/RT/Extension/Assets/AppleGSX.pm
+++ b/lib/RT/Extension/Assets/AppleGSX.pm
@@ -192,13 +192,13 @@ and your server IP addresses must be whitelisted by Apple.
The configuration for the service uses the following variables:
# test server
- Set( $AppleGSXApiBase, 'https://partner-connect-uat.apple.com/gsx/api');
+ Set( $AppleGSXApiBase, 'https://partner-connect-uat.apple.com');
Set( $AppleGSXGetToken, 'https://gsx2-uat.apple.com/gsx/api/login');
or
# production server
- Set( $AppleGSXApiBase, 'https://partner-connect.apple.com/gsx/api');
+ Set( $AppleGSXApiBase, 'https://partner-connect.apple.com');
Set( $AppleGSXGetToken, 'https://gsx2.apple.com/gsx/api/login');
Once you have done this, you can configure the authentication information
diff --git a/lib/RT/Extension/Assets/AppleGSX/Client.pm b/lib/RT/Extension/Assets/AppleGSX/Client.pm
index 1e30d94..6dd424e 100644
--- a/lib/RT/Extension/Assets/AppleGSX/Client.pm
+++ b/lib/RT/Extension/Assets/AppleGSX/Client.pm
@@ -50,7 +50,7 @@ sub new {
$self->UserAgent->default_headers( $default_headers );
# by default use the testing (-uat) URL
- $self->{AppleGSXApiBase} = RT->Config->Get('AppleGSXApiBase') || 'https://partner-connect-uat.apple.com/gsx/api';
+ $self->{AppleGSXApiBase} = RT->Config->Get('AppleGSXApiBase') || 'https://partner-connect-uat.apple.com';
# debug_ua($self->UserAgent);
return $self;
@@ -62,8 +62,8 @@ sub Authenticate {
my %headers = ( Accept => 'text/plain' );
RT->Logger->debug("Using AppleGSXApiBase: " . $self->AppleGSXApiBase);
- RT->Logger->debug("Calling GSX /authenticate/check with headers: " . $self->UserAgent->default_headers->as_string . " and " . Dumper(\%headers));
- my $res = $self->UserAgent->get( $self->AppleGSXApiBase . "/authenticate/check", %headers );
+ RT->Logger->debug("Calling GSX api/authenticate/check with headers: " . $self->UserAgent->default_headers->as_string . " and " . Dumper(\%headers));
+ my $res = $self->UserAgent->get( $self->AppleGSXApiBase . "/api/authenticate/check", %headers );
if ( $res->is_success ) {
return 1;
}
@@ -108,7 +108,7 @@ sub GetDataForSerial {
# only try if we have a token, otherwise we need to get one first
if( $token) {
- $response = $self->UserAgent->post( $self->AppleGSXApiBase . "/repair/product/details", Content => $json, %headers );
+ $response = $self->UserAgent->post( $self->AppleGSXApiBase . "/gsx/api/repair/product/details", Content => $json, %headers );
}
if( ! $token || $response->code == 401 ) {
@@ -125,7 +125,7 @@ sub GetDataForSerial {
if( $ret) {
RT->Logger->debug( "Got new authentication token");
$headers{'X-Apple-Auth-Token'} = $new_token;
- $response = $self->UserAgent->post( $self->AppleGSXApiBase . "/repair/product/details", Content => $json, %headers);
+ $response = $self->UserAgent->post( $self->AppleGSXApiBase . "/gsx/api/repair/product/details", Content => $json, %headers);
}
else {
return ( 0, "error connecting to the GSX API: $msg", undef);
@@ -163,7 +163,7 @@ sub get_new_authentication_token {
RT->Logger->debug("Getting authentication token with AppleGSXApiBase: " . $self->AppleGSXApiBase .
" and content $json");
- my $response = $self->UserAgent->post( $self->AppleGSXApiBase . "/authenticate/token", Content => $json, %headers );
+ my $response = $self->UserAgent->post( $self->AppleGSXApiBase . "/api/authenticate/token", Content => $json, %headers );
if( $response->code == 200 ) {
my $json_string = $response->decoded_content;
my $response_json = decode_json( $json_string);
commit c3e98db51b7691a80572727948e55629f2123ea1
Author: Jim Brandt <jbrandt at bestpractical.com>
Date: Fri Jul 30 13:51:56 2021 -0400
Version 2.03
diff --git a/Changes b/Changes
index 4ebefef..6ec9fba 100644
--- a/Changes
+++ b/Changes
@@ -1,5 +1,9 @@
Revision history for RT-Extension-Assets-AppleGSX
+2.03 2021-07-30
+
+ - Add debug logs to auth phase
+
2.02 2021-07-28
- Make sure to apply config values and add debug logging to verify.
diff --git a/META.yml b/META.yml
index 944877b..23e0d60 100644
--- a/META.yml
+++ b/META.yml
@@ -30,6 +30,6 @@ requires:
perl: 5.8.3
resources:
license: http://opensource.org/licenses/gpl-license.php
-version: '2.02'
+version: '2.03'
x_module_install_rtx_version: '0.42'
x_requires_rt: 4.0.0
diff --git a/lib/RT/Extension/Assets/AppleGSX.pm b/lib/RT/Extension/Assets/AppleGSX.pm
index 4035939..0e32f6a 100644
--- a/lib/RT/Extension/Assets/AppleGSX.pm
+++ b/lib/RT/Extension/Assets/AppleGSX.pm
@@ -3,7 +3,7 @@ use warnings;
package RT::Extension::Assets::AppleGSX;
use RT::Extension::Assets::AppleGSX::Client;
-our $VERSION = '2.02';
+our $VERSION = '2.03';
my $CLIENT;
my $CLIENT_CACHE;
commit 3562e876f1592f3e8deb3a1c96c28691d652926e
Author: Jim Brandt <jbrandt at bestpractical.com>
Date: Fri Jul 30 13:50:42 2021 -0400
Add debug logs to auth phase
diff --git a/lib/RT/Extension/Assets/AppleGSX/Client.pm b/lib/RT/Extension/Assets/AppleGSX/Client.pm
index 08ba346..1e30d94 100644
--- a/lib/RT/Extension/Assets/AppleGSX/Client.pm
+++ b/lib/RT/Extension/Assets/AppleGSX/Client.pm
@@ -114,14 +114,16 @@ sub GetDataForSerial {
if( ! $token || $response->code == 401 ) {
my( $ret, $msg, $new_token );
if( $token ) {
+ RT->Logger->debug('Getting new authentication token');
( $ret, $msg, $new_token )= $self->get_new_authentication_token( $token );
}
if( ! $token || ! $ret) {
+ RT->Logger->debug('Requesting new authentication token using activation token');
( $ret, $msg, $new_token)= $self->get_new_authentication_token( $self->ActivationToken );
}
if( $ret) {
- RT->Logger->debug( "got new authentication token");
+ RT->Logger->debug( "Got new authentication token");
$headers{'X-Apple-Auth-Token'} = $new_token;
$response = $self->UserAgent->post( $self->AppleGSXApiBase . "/repair/product/details", Content => $json, %headers);
}
@@ -158,6 +160,9 @@ sub get_new_authentication_token {
'Content-Type' => 'application/json',
Accept => 'application/json',
);
+
+ RT->Logger->debug("Getting authentication token with AppleGSXApiBase: " . $self->AppleGSXApiBase .
+ " and content $json");
my $response = $self->UserAgent->post( $self->AppleGSXApiBase . "/authenticate/token", Content => $json, %headers );
if( $response->code == 200 ) {
my $json_string = $response->decoded_content;
@@ -177,7 +182,7 @@ sub get_new_authentication_token {
return ( 1, '', $new_authentication_token);
}
else {
- RT->Logger->error( "Failed to get authentication token" );
+ RT->Logger->error( "Failed to get authentication token " . $response->code . ' ' . $response->decoded_content );
return( 0, "cannot get authentication token: " . $response->code, undef);
}
}
commit 77e2ab64c1ca6ab2cdff6bb68e9f749bc44fb60e
Author: Jim Brandt <jbrandt at bestpractical.com>
Date: Wed Jul 28 16:34:10 2021 -0400
Version 2.02
diff --git a/Changes b/Changes
index de1c3b9..4ebefef 100644
--- a/Changes
+++ b/Changes
@@ -1,5 +1,9 @@
Revision history for RT-Extension-Assets-AppleGSX
+2.02 2021-07-28
+
+ - Make sure to apply config values and add debug logging to verify.
+
2.01 2021-06-04
- Add required X-Apple-Service-Version header to calls for version 2 API.
diff --git a/META.yml b/META.yml
index 59d13bd..944877b 100644
--- a/META.yml
+++ b/META.yml
@@ -30,6 +30,6 @@ requires:
perl: 5.8.3
resources:
license: http://opensource.org/licenses/gpl-license.php
-version: '2.01'
+version: '2.02'
x_module_install_rtx_version: '0.42'
x_requires_rt: 4.0.0
diff --git a/lib/RT/Extension/Assets/AppleGSX.pm b/lib/RT/Extension/Assets/AppleGSX.pm
index e5aa2dc..4035939 100644
--- a/lib/RT/Extension/Assets/AppleGSX.pm
+++ b/lib/RT/Extension/Assets/AppleGSX.pm
@@ -3,7 +3,7 @@ use warnings;
package RT::Extension::Assets::AppleGSX;
use RT::Extension::Assets::AppleGSX::Client;
-our $VERSION = '2.01';
+our $VERSION = '2.02';
my $CLIENT;
my $CLIENT_CACHE;
commit 46da73c02383f4de5acccc577b196e1702289446
Author: Jim Brandt <jbrandt at bestpractical.com>
Date: Wed Jul 28 16:31:37 2021 -0400
Restore docs previously added directly to README and over-written
diff --git a/README b/README
index a55db00..89be1e3 100644
--- a/README
+++ b/README
@@ -41,6 +41,18 @@ CONFIGURATION
account number, you must then get certificate and key files from Apple
and your server IP addresses must be whitelisted by Apple.
+ The configuration for the service uses the following variables:
+
+ # test server
+ Set( $AppleGSXApiBase, 'https://partner-connect-uat.apple.com/gsx/api');
+ Set( $AppleGSXGetToken, 'https://gsx2-uat.apple.com/gsx/api/login');
+
+ or
+
+ # production server
+ Set( $AppleGSXApiBase, 'https://partner-connect.apple.com/gsx/api');
+ Set( $AppleGSXGetToken, 'https://gsx2.apple.com/gsx/api/login');
+
Once you have done this, you can configure the authentication
information used to connect to GSX via the web UI, at Tools ->
Configuration -> Assets -> Apple GSX. This menu option is only available
diff --git a/lib/RT/Extension/Assets/AppleGSX.pm b/lib/RT/Extension/Assets/AppleGSX.pm
index c5d259f..e5aa2dc 100644
--- a/lib/RT/Extension/Assets/AppleGSX.pm
+++ b/lib/RT/Extension/Assets/AppleGSX.pm
@@ -189,6 +189,18 @@ create an account. Once you have an account with a user ID and service
account number, you must then get certificate and key files from Apple
and your server IP addresses must be whitelisted by Apple.
+The configuration for the service uses the following variables:
+
+ # test server
+ Set( $AppleGSXApiBase, 'https://partner-connect-uat.apple.com/gsx/api');
+ Set( $AppleGSXGetToken, 'https://gsx2-uat.apple.com/gsx/api/login');
+
+or
+
+ # production server
+ Set( $AppleGSXApiBase, 'https://partner-connect.apple.com/gsx/api');
+ Set( $AppleGSXGetToken, 'https://gsx2.apple.com/gsx/api/login');
+
Once you have done this, you can configure the authentication information
used to connect to GSX via the web UI, at Tools -> Configuration ->
Assets -> Apple GSX. This menu option is only available to SuperUsers.
commit 408740d992c91eb997ce3c930ff826d9fc119e28
Author: Jim Brandt <jbrandt at bestpractical.com>
Date: Wed Jul 28 16:29:49 2021 -0400
Apply the set AppleGSXApiBase config value if available
Add debug logging to see the currently set value. Remove the
line setting the token login since the Mason page pulls that
value directly from RT->Config.
diff --git a/lib/RT/Extension/Assets/AppleGSX/Client.pm b/lib/RT/Extension/Assets/AppleGSX/Client.pm
index 0b9905b..08ba346 100644
--- a/lib/RT/Extension/Assets/AppleGSX/Client.pm
+++ b/lib/RT/Extension/Assets/AppleGSX/Client.pm
@@ -49,9 +49,9 @@ sub new {
);
$self->UserAgent->default_headers( $default_headers );
- # by default use the testing (-uat) URLs for both the API and getting the initial token
- $self->{AppleGSXApiBase} ||= 'https://partner-connect-uat.apple.com/gsx/api';
- $self->{AppleGSXGetToken} ||= 'https://gsx2-uat.apple.com/gsx/api/login';
+ # by default use the testing (-uat) URL
+ $self->{AppleGSXApiBase} = RT->Config->Get('AppleGSXApiBase') || 'https://partner-connect-uat.apple.com/gsx/api';
+
# debug_ua($self->UserAgent);
return $self;
}
@@ -61,6 +61,7 @@ sub Authenticate {
my $self = shift;
my %headers = ( Accept => 'text/plain' );
+ RT->Logger->debug("Using AppleGSXApiBase: " . $self->AppleGSXApiBase);
RT->Logger->debug("Calling GSX /authenticate/check with headers: " . $self->UserAgent->default_headers->as_string . " and " . Dumper(\%headers));
my $res = $self->UserAgent->get( $self->AppleGSXApiBase . "/authenticate/check", %headers );
if ( $res->is_success ) {
commit 09c95810fe82cba48ad896a772db3e2b4f432f0d
Author: Jim Brandt <jbrandt at bestpractical.com>
Date: Thu Jun 17 10:42:28 2021 -0400
Comment out ConsoleLogger to avoid new dependency
diff --git a/lib/RT/Extension/Assets/AppleGSX/Client.pm b/lib/RT/Extension/Assets/AppleGSX/Client.pm
index b741546..0b9905b 100644
--- a/lib/RT/Extension/Assets/AppleGSX/Client.pm
+++ b/lib/RT/Extension/Assets/AppleGSX/Client.pm
@@ -8,7 +8,7 @@ use LWP::UserAgent;
use JSON;
use Data::Dumper;
-use LWP::ConsoleLogger::Easy qw( debug_ua );
+# use LWP::ConsoleLogger::Easy qw( debug_ua );
use base 'Class::Accessor::Fast';
__PACKAGE__->mk_accessors(
@@ -52,7 +52,7 @@ sub new {
# by default use the testing (-uat) URLs for both the API and getting the initial token
$self->{AppleGSXApiBase} ||= 'https://partner-connect-uat.apple.com/gsx/api';
$self->{AppleGSXGetToken} ||= 'https://gsx2-uat.apple.com/gsx/api/login';
- debug_ua($self->UserAgent);
+ # debug_ua($self->UserAgent);
return $self;
}
commit 90f9927555f3435ed2d53e8828020661f476a9ce
Author: Jim Brandt <jbrandt at bestpractical.com>
Date: Fri Jun 11 09:28:13 2021 -0400
Add more debug logging
diff --git a/lib/RT/Extension/Assets/AppleGSX/Client.pm b/lib/RT/Extension/Assets/AppleGSX/Client.pm
index d336a7d..b741546 100644
--- a/lib/RT/Extension/Assets/AppleGSX/Client.pm
+++ b/lib/RT/Extension/Assets/AppleGSX/Client.pm
@@ -8,6 +8,7 @@ use LWP::UserAgent;
use JSON;
use Data::Dumper;
+use LWP::ConsoleLogger::Easy qw( debug_ua );
use base 'Class::Accessor::Fast';
__PACKAGE__->mk_accessors(
@@ -21,7 +22,23 @@ sub new {
my $self = $class->SUPER::new($args);
$ENV{HTTPS_CERT_FILE} = $self->CertFilePath;
+
+ if ( -r $ENV{HTTPS_CERT_FILE} ) {
+ RT->Logger->debug("RT can read HTTPS_CERT_FILE: " . $ENV{HTTPS_CERT_FILE});
+ }
+ else {
+ RT->Logger->debug("RT *cannot* read HTTPS_CERT_FILE: " . $ENV{HTTPS_CERT_FILE});
+ }
+
$ENV{HTTPS_KEY_FILE} = $self->KeyFilePath;
+
+ if ( -r $ENV{HTTPS_KEY_FILE} ) {
+ RT->Logger->debug("RT can read HTTPS_KEY_FILE: " . $ENV{HTTPS_KEY_FILE});
+ }
+ else {
+ RT->Logger->debug("RT *cannot* read HTTPS_KEY_FILE: " . $ENV{HTTPS_KEY_FILE});
+ }
+
my $store_code = sprintf( "%010d", $self->ServiceAccountNo);
$self->UserAgent( LWP::UserAgent->new(ssl_opts => { verify_hostname => 0 }) ) unless $self->UserAgent;
@@ -35,7 +52,7 @@ sub new {
# by default use the testing (-uat) URLs for both the API and getting the initial token
$self->{AppleGSXApiBase} ||= 'https://partner-connect-uat.apple.com/gsx/api';
$self->{AppleGSXGetToken} ||= 'https://gsx2-uat.apple.com/gsx/api/login';
-
+ debug_ua($self->UserAgent);
return $self;
}
commit e7601a4da1377380272b86f89e047d9d57c59001
Author: Jim Brandt <jbrandt at bestpractical.com>
Date: Mon Jun 7 13:32:21 2021 -0400
Add debug logging to authentication check
diff --git a/lib/RT/Extension/Assets/AppleGSX/Client.pm b/lib/RT/Extension/Assets/AppleGSX/Client.pm
index b6dd4c5..d336a7d 100644
--- a/lib/RT/Extension/Assets/AppleGSX/Client.pm
+++ b/lib/RT/Extension/Assets/AppleGSX/Client.pm
@@ -7,6 +7,7 @@ use Net::SSL;
use LWP::UserAgent;
use JSON;
+use Data::Dumper;
use base 'Class::Accessor::Fast';
__PACKAGE__->mk_accessors(
@@ -43,12 +44,15 @@ sub Authenticate {
my $self = shift;
my %headers = ( Accept => 'text/plain' );
+ RT->Logger->debug("Calling GSX /authenticate/check with headers: " . $self->UserAgent->default_headers->as_string . " and " . Dumper(\%headers));
my $res = $self->UserAgent->get( $self->AppleGSXApiBase . "/authenticate/check", %headers );
if ( $res->is_success ) {
return 1;
}
else {
RT->Logger->error( "Failed to authenticate to Apple GSX: " . $res->status_line );
+ my $string = $res->decoded_content;
+ RT->Logger->debug("Response content is: $string");
return;
}
}
-----------------------------------------------------------------------
Summary of changes:
Changes | 14 ++++++++++
META.yml | 2 +-
README | 12 ++++++++
lib/RT/Extension/Assets/AppleGSX.pm | 14 +++++++++-
lib/RT/Extension/Assets/AppleGSX/Client.pm | 45 ++++++++++++++++++++++++------
5 files changed, 76 insertions(+), 11 deletions(-)
hooks/post-receive
--
rt-extension-assets-applegsx
More information about the Bps-public-commit
mailing list