Skip to content
Snippets Groups Projects
Commit 5c185edc authored by Guillaume ROUSSE's avatar Guillaume ROUSSE
Browse files

rename token attribute from 'token' to 'secret'

parent aed5719e
Branches
Tags
No related merge requests found
...@@ -454,7 +454,7 @@ sub req_complete_challenge { ...@@ -454,7 +454,7 @@ sub req_complete_challenge {
sp_entityid => $entityid, sp_entityid => $entityid,
creation_date => DateTime->now(), creation_date => DateTime->now(),
expiration_date => DateTime->now()->add(hours => $validity_period), expiration_date => DateTime->now()->add(hours => $validity_period),
token => AccountManager::Tools::generate_secret(20) secret => AccountManager::Tools::generate_secret(20)
); );
$self->abort( $self->abort(
...@@ -477,7 +477,7 @@ sub req_complete_challenge { ...@@ -477,7 +477,7 @@ sub req_complete_challenge {
sourceip => $ENV{REMOTE_ADDR}, sourceip => $ENV{REMOTE_ADDR},
to => $email, to => $email,
entityid => $entityid, entityid => $entityid,
token => $token->token(), token => $token->secret(),
challenge_url => sprintf( challenge_url => sprintf(
'%s&action=complete_challenge&federation=%s&entity=%s&email=%s', '%s&action=complete_challenge&federation=%s&entity=%s&email=%s',
$self->{configuration}->{app}->{url}, $self->{configuration}->{app}->{url},
...@@ -535,7 +535,7 @@ sub req_complete_challenge { ...@@ -535,7 +535,7 @@ sub req_complete_challenge {
"Token send to %s for entityid=%s;token=%s", "Token send to %s for entityid=%s;token=%s",
$email, $email,
$entityid, $entityid,
$token->token(), $token->secret(),
); );
$self->respond( $self->respond(
...@@ -575,8 +575,8 @@ sub req_create_accounts { ...@@ -575,8 +575,8 @@ sub req_create_accounts {
) if !$email; ) if !$email;
my $token = AccountManager::Token->new( my $token = AccountManager::Token->new(
db => $self->{db}, db => $self->{db},
token => $token_secret secret => $token_secret
); );
$self->abort( $self->abort(
...@@ -622,7 +622,7 @@ sub req_create_accounts { ...@@ -622,7 +622,7 @@ sub req_create_accounts {
sp_entityid => $entityid, sp_entityid => $entityid,
creation_date => DateTime->now(), creation_date => DateTime->now(),
expiration_date => DateTime->now()->add(hours => $validity_period), expiration_date => DateTime->now()->add(hours => $validity_period),
token => AccountManager::Tools::generate_secret(20) secret => AccountManager::Tools::generate_secret(20)
); );
$self->abort( $self->abort(
...@@ -642,7 +642,7 @@ sub req_create_accounts { ...@@ -642,7 +642,7 @@ sub req_create_accounts {
password => $password, password => $password,
password_crypt => AccountManager::Tools::encrypt($password, $key), password_crypt => AccountManager::Tools::encrypt($password, $key),
password_hash => AccountManager::Tools::sha256_hash($password), password_hash => AccountManager::Tools::sha256_hash($password),
token => $download_token->token(), token => $download_token->secret(),
creation_date => DateTime->now(), creation_date => DateTime->now(),
expiration_date => DateTime->now()->add(days => $validity_period) expiration_date => DateTime->now()->add(days => $validity_period)
); );
...@@ -690,7 +690,7 @@ sub req_create_accounts { ...@@ -690,7 +690,7 @@ sub req_create_accounts {
entityid => $entityid, entityid => $entityid,
email => $email, email => $email,
key => $key, key => $key,
token => $download_token->token(), token => $download_token->secret(),
days => $validity_period, days => $validity_period,
} }
); );
...@@ -722,8 +722,8 @@ sub req_download_accounts { ...@@ -722,8 +722,8 @@ sub req_download_accounts {
) if !$key; ) if !$key;
my $token = AccountManager::Token->new( my $token = AccountManager::Token->new(
db => $self->{db}, db => $self->{db},
token => $token_secret secret => $token_secret
); );
$self->abort( $self->abort(
...@@ -756,7 +756,7 @@ sub req_download_accounts { ...@@ -756,7 +756,7 @@ sub req_download_accounts {
my $accounts = AccountManager::Account->get_accounts( my $accounts = AccountManager::Account->get_accounts(
db => $self->{db}, db => $self->{db},
query => [ query => [
token => $self->{in}->{token} token => $token_secret
], ],
); );
......
...@@ -12,7 +12,7 @@ __PACKAGE__->meta->setup( ...@@ -12,7 +12,7 @@ __PACKAGE__->meta->setup(
columns => [ columns => [
id => { type => 'bigserial', not_null => 1 }, id => { type => 'bigserial', not_null => 1 },
token => { type => 'varchar', length => 50, not_null => 1 }, token => { type => 'varchar', length => 50, not_null => 1, alias => 'secret' },
email_address => { type => 'varchar', length => 200, not_null => 1 }, email_address => { type => 'varchar', length => 200, not_null => 1 },
sp_entityid => { type => 'varchar', length => 200, not_null => 1 }, sp_entityid => { type => 'varchar', length => 200, not_null => 1 },
creation_date => { type => 'datetime' }, creation_date => { type => 'datetime' },
...@@ -34,9 +34,9 @@ sub print { ...@@ -34,9 +34,9 @@ sub print {
$fd = \*STDOUT unless $fd; $fd = \*STDOUT unless $fd;
printf $fd printf $fd
"Token ID=%s; token=%s; email_address=%s; sp_entityid=%s; creation_date=%s; expiration_date=%s\n", "Token ID=%s; secret=%s; email_address=%s; sp_entityid=%s; creation_date=%s; expiration_date=%s\n",
$self->id(), $self->id(),
$self->token(), $self->secret(),
$self->email_address(), $self->email_address(),
$self->sp_entityid(), $self->sp_entityid(),
$self->creation_date()->strftime('%Y:%m:%d %H:%M'), $self->creation_date()->strftime('%Y:%m:%d %H:%M'),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment