WIP - checkUser display transmitted headers (#1658)
This commit is contained in:
parent
e296d1d407
commit
ba2ab0c4a2
|
@ -28,7 +28,8 @@ has ott => (
|
||||||
);
|
);
|
||||||
|
|
||||||
sub hAttr {
|
sub hAttr {
|
||||||
$_[0]->{conf}->{checkUserHiddenAttributes} . ' ' . $_[0]->{conf}->{hiddenAttributes} ;
|
$_[0]->{conf}->{checkUserHiddenAttributes} . ' '
|
||||||
|
. $_[0]->{conf}->{hiddenAttributes};
|
||||||
}
|
}
|
||||||
|
|
||||||
sub init {
|
sub init {
|
||||||
|
@ -40,7 +41,7 @@ sub init {
|
||||||
# RUNNING METHOD
|
# RUNNING METHOD
|
||||||
|
|
||||||
sub check {
|
sub check {
|
||||||
my ( $self, $req ) = @_;
|
my ( $self, $req ) = @_;
|
||||||
my ( $hdrs, $attrs, $array_attrs, $array_hdrs ) = ( {}, {}, [], [] );
|
my ( $hdrs, $attrs, $array_attrs, $array_hdrs ) = ( {}, {}, [], [] );
|
||||||
my $msg = 'checkUser';
|
my $msg = 'checkUser';
|
||||||
my $result = '';
|
my $result = '';
|
||||||
|
@ -63,9 +64,10 @@ sub check {
|
||||||
while ( my ( $k, $v ) = each %$attrs ) {
|
while ( my ( $k, $v ) = each %$attrs ) {
|
||||||
|
|
||||||
# Ignore hidden attributes
|
# Ignore hidden attributes
|
||||||
push @$array_attrs, { key => $k, value => $v } unless ( $self->hAttr =~ /\b$k\b/ or !$v );
|
push @$array_attrs, { key => $k, value => $v }
|
||||||
|
unless ( $self->hAttr =~ /\b$k\b/ or !$v );
|
||||||
}
|
}
|
||||||
@$array_attrs = sort { $a->{key} cmp $b->{key} } @$array_attrs;
|
@$array_attrs = sort { $a->{key} cmp $b->{key} } @$array_attrs;
|
||||||
|
|
||||||
# Check if user is allowed to access submitted URL and compute headers
|
# Check if user is allowed to access submitted URL and compute headers
|
||||||
if ( $url and %$attrs ) {
|
if ( $url and %$attrs ) {
|
||||||
|
@ -79,13 +81,7 @@ sub check {
|
||||||
"checkUser -> $req->{user} is $result to access: $url");
|
"checkUser -> $req->{user} is $result to access: $url");
|
||||||
|
|
||||||
# Return VirtualHost headers
|
# Return VirtualHost headers
|
||||||
$hdrs = $self->_headers( $req, $url );
|
$array_hdrs = $self->_headers( $req, $url );
|
||||||
while ( my ( $k, $v ) = each %$hdrs ) {
|
|
||||||
push @$array_hdrs, { key => $k, value => $v };
|
|
||||||
}
|
|
||||||
@$array_hdrs = sort { $a->{key} cmp $b->{key} } @$array_hdrs;
|
|
||||||
|
|
||||||
$self->logger->debug( "+++++++++++++ " . Dumper($array_hdrs) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Display form
|
# Display form
|
||||||
|
@ -93,13 +89,13 @@ sub check {
|
||||||
$req,
|
$req,
|
||||||
'checkuser',
|
'checkuser',
|
||||||
params => {
|
params => {
|
||||||
PORTAL => $self->conf->{portal},
|
PORTAL => $self->conf->{portal},
|
||||||
MAIN_LOGO => $self->conf->{portalMainLogo},
|
MAIN_LOGO => $self->conf->{portalMainLogo},
|
||||||
LANGS => $self->conf->{showLanguages},
|
LANGS => $self->conf->{showLanguages},
|
||||||
MSG => $msg,
|
MSG => $msg,
|
||||||
LOGIN => $req->{user},
|
LOGIN => $req->{user},
|
||||||
URL => $url,
|
URL => $url,
|
||||||
ALLOWED => $result,
|
ALLOWED => $result,
|
||||||
HEADERS => $array_hdrs,
|
HEADERS => $array_hdrs,
|
||||||
ATTRIBUTES => $array_attrs,
|
ATTRIBUTES => $array_attrs,
|
||||||
}
|
}
|
||||||
|
@ -111,8 +107,9 @@ sub _attributes {
|
||||||
|
|
||||||
# Search user in database
|
# Search user in database
|
||||||
$req->steps(
|
$req->steps(
|
||||||
[ 'getUser', 'setSessionInfo',
|
[ 'getUser', 'setSessionInfo',
|
||||||
'setMacros', 'setGroups',
|
'setMacros', 'setGroups',
|
||||||
|
|
||||||
#'setPersistentSessionInfo', 'setLocalGroups'
|
#'setPersistentSessionInfo', 'setLocalGroups'
|
||||||
'setLocalGroups'
|
'setLocalGroups'
|
||||||
]
|
]
|
||||||
|
@ -142,8 +139,12 @@ sub _authorized {
|
||||||
}
|
}
|
||||||
|
|
||||||
sub _headers {
|
sub _headers {
|
||||||
my ( $self, $req ) = @_;
|
my ( $self, $req, $uri ) = @_;
|
||||||
return { 'HEADER1' => 'TEST' };
|
my ( $vhost, $appuri ) = $uri =~ m#^https?://([^/]*)(.*)#;
|
||||||
|
$vhost =~ s/:\d+$//;
|
||||||
|
$req->{env}->{HTTP_HOST} = $vhost;
|
||||||
|
$self->p->HANDLER->headersInit( $self->{conf} );
|
||||||
|
return $self->p->HANDLER->checkHeaders( $req, $req->{sessionInfo} );
|
||||||
}
|
}
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user