Skip to content

Commit

Permalink
remove undocumented legacy_args
Browse files Browse the repository at this point in the history
the only thing using this[1] was Mojolicious::Plugin::OAuth2::Server
which has been updated to use hash args so no need for this any more

remove all code, tests, and attributes related to this functionality

[1] "only thing" - anything else using it gets to keep both pieces
as it was undocumented for a reason
  • Loading branch information
leejo committed Nov 1, 2016
1 parent e570d3c commit a335511
Show file tree
Hide file tree
Showing 9 changed files with 7 additions and 236 deletions.
3 changes: 3 additions & 0 deletions Changes
@@ -1,5 +1,8 @@
Revision history for Net-OAuth2-AuthorizationServer

0.13 2016-10-15
- Remove undocumented legacy_args flag

0.12 2016-10-15
- Deprecate undocumented legacy_args flag

Expand Down
4 changes: 0 additions & 4 deletions MANIFEST
Expand Up @@ -22,19 +22,15 @@ t/001_compiles_pod.t
t/003_changes.t
t/net/oauth2/authorizationserver.t
t/net/oauth2/authorizationserver/authorizationcodegrant.t
t/net/oauth2/authorizationserver/authorizationcodegrant_legacy_args.t
t/net/oauth2/authorizationserver/authorizationcodegrant_no_jwt.t
t/net/oauth2/authorizationserver/authorizationcodegrant_tests.pm
t/net/oauth2/authorizationserver/clientcredentialsgrant.t
t/net/oauth2/authorizationserver/clientcredentialsgrant_legacy_args.t
t/net/oauth2/authorizationserver/clientcredentialsgrant_no_jwt.t
t/net/oauth2/authorizationserver/clientcredentialsgrant_tests.pm
t/net/oauth2/authorizationserver/defaults.t
t/net/oauth2/authorizationserver/implicitgrant.t
t/net/oauth2/authorizationserver/implicitgrant_legacy_args.t
t/net/oauth2/authorizationserver/implicitgrant_no_jwt.t
t/net/oauth2/authorizationserver/implicitgrant_tests.pm
t/net/oauth2/authorizationserver/passwordgrant.t
t/net/oauth2/authorizationserver/passwordgrant_legacy_args.t
t/net/oauth2/authorizationserver/passwordgrant_no_jwt.t
t/net/oauth2/authorizationserver/passwordgrant_tests.pm
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -11,7 +11,7 @@ Authorization Server

# VERSION

0.11
0.13

# SYNOPSIS

Expand Down
4 changes: 2 additions & 2 deletions lib/Net/OAuth2/AuthorizationServer.pm
Expand Up @@ -11,7 +11,7 @@ Authorization Server
=head1 VERSION
0.12
0.13
=head1 SYNOPSIS
Expand Down Expand Up @@ -45,7 +45,7 @@ use Net::OAuth2::AuthorizationServer::ImplicitGrant;
use Net::OAuth2::AuthorizationServer::PasswordGrant;
use Net::OAuth2::AuthorizationServer::ClientCredentialsGrant;

our $VERSION = '0.12';
our $VERSION = '0.13';

=head1 GRANT TYPES
Expand Down
59 changes: 1 addition & 58 deletions lib/Net/OAuth2/AuthorizationServer/Defaults.pm
Expand Up @@ -13,12 +13,6 @@ use Try::Tiny;
use Time::HiRes qw/ gettimeofday /;
use MIME::Base64 qw/ encode_base64 /;

# undocumented for Mojolicious::Plugin::OAuth2::Server
has 'legacy_args' => (
is => 'rw',
required => 0,
);

has 'jwt_secret' => (
is => 'ro',
isa => Str,
Expand Down Expand Up @@ -117,8 +111,6 @@ sub verify_token_and_scope {
);
}

my $warned_dep = 0;

sub _delegate_to_cb_or_private {

my $method = shift;
Expand All @@ -129,56 +121,7 @@ sub _delegate_to_cb_or_private {
my $p_method = "_$method";

if ( my $cb = $self->$cb_method ) {

# TODO: remove legacy_args in next version
if ( my $obj = $self->legacy_args ) {

warn "->legacy_args of @{[ __PACKAGE__ ]} is DEPRECATED"
unless $warned_dep++;

# for older users of Mojolicious::Plugin::OAuth2::Server need to pass
# the right arguments in the right order to each function
for ( $method ) {

/login_resource_owner|confirm_by_resource_owner|verify_client/ && do {
return $cb->( $obj, @args{ qw/ client_id scopes redirect_uri response_type client_secret / } );
};

$self->_uses_user_passwords && /verify_user_password/ && do {
return $cb->( $obj, @args{ qw/ client_id client_secret username password scopes / } );
};

$self->_uses_auth_codes && /store_auth_code/ && do {
my @scopes = @{ $args{ scopes } };
return $cb->(
$obj, @args{ qw/ auth_code client_id expires_in redirect_uri / }, @scopes
);
};

$self->_uses_auth_codes && /verify_auth_code/ && do {
return $cb->( $obj,
@args{ qw/ client_id client_secret auth_code redirect_uri / } );
};

/store_access_token/ && do {
return $cb->(
$obj,
@args{
qw/ client_id auth_code access_token refresh_token expires_in scopes old_refresh_token /
}
);
};

/verify_access_token/ && do {
return $cb->( $obj, @args{ qw/ access_token scopes is_refresh_token / } );
};
}

}
else {
return $cb->( %args );
}

return $cb->( %args );
}
else {
return $self->$p_method( %args );
Expand Down

This file was deleted.

This file was deleted.

40 changes: 0 additions & 40 deletions t/net/oauth2/authorizationserver/implicitgrant_legacy_args.t

This file was deleted.

45 changes: 0 additions & 45 deletions t/net/oauth2/authorizationserver/passwordgrant_legacy_args.t

This file was deleted.

0 comments on commit a335511

Please sign in to comment.