Re: [dspace-tech] Re: LDAPAuthentication - can't create ePerson at DEBUG

2020-02-24 Thread Ondrej Kosarko
Sounds a bit like [ https://jira.lyrasis.org/browse/DS-2505 | 
https://jira.lyrasis.org/browse/DS-2505 ] 

Ondrej 

From: "Mark H. Wood"  
To: "DSpace Technical Support"  
Sent: Thursday, 20 February, 2020 15:49:45 
Subject: Re: [dspace-tech] Re: LDAPAuthentication - can't create ePerson at 
DEBUG 

I took a quick look at LDAPAuthentication.java. From the log 
messages, it seems that execution reached the log.info() call at line 
368. This flows down to the 'return' at line 370 BUT we are still in 
a try{} with a finally{}, so it appears that this method will call 
context.restoreAuthSystemState() twice before actually returning. 
restoreAuthSystemState() catches the EmptyStackException and logs it. 

The nested try{} blocks are a bit muddled. The method needs thorough 
study and probably some re-organization. 

There is quite a bit of code in Context#restoreAuthSystemState which 
is only executed when debugging is enabled, around line 303 ff. I'm 
not sure what it is for. This code *also* pops a stack without 
checking for underflow, and in this case any resulting exception is 
not caught, which may yield interesting results. 

That's not a thorough analysis, but it is a start. 

-- 
Mark H. Wood 
Lead Technology Analyst 

University Library 
Indiana University - Purdue University Indianapolis 
755 W. Michigan Street 
Indianapolis, IN 46202 
317-274-0749 
www.ulib.iupui.edu 

-- 
All messages to this mailing list should adhere to the DuraSpace Code of 
Conduct: https://duraspace.org/about/policies/code-of-conduct/ 
--- 
You received this message because you are subscribed to the Google Groups 
"DSpace Technical Support" group. 
To unsubscribe from this group and stop receiving emails from it, send an email 
to dspace-tech+unsubscr...@googlegroups.com. 
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dspace-tech/20200220144945.GC1294%40IUPUI.Edu.
 

-- 
All messages to this mailing list should adhere to the DuraSpace Code of 
Conduct: https://duraspace.org/about/policies/code-of-conduct/
--- 
You received this message because you are subscribed to the Google Groups 
"DSpace Technical Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dspace-tech+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dspace-tech/1526378737.2136151.1582532588148.JavaMail.zimbra%40ufal.mff.cuni.cz.


Re: [dspace-tech] Re: LDAPAuthentication - can't create ePerson at DEBUG

2020-02-20 Thread Mark H. Wood
I took a quick look at LDAPAuthentication.java.  From the log
messages, it seems that execution reached the log.info() call at line
368.  This flows down to the 'return' at line 370 BUT we are still in
a try{} with a finally{}, so it appears that this method will call
context.restoreAuthSystemState() twice before actually returning.
restoreAuthSystemState() catches the EmptyStackException and logs it.

The nested try{} blocks are a bit muddled.  The method needs thorough
study and probably some re-organization.

There is quite a bit of code in Context#restoreAuthSystemState which
is only executed when debugging is enabled, around line 303 ff.  I'm
not sure what it is for.  This code *also* pops a stack without
checking for underflow, and in this case any resulting exception is
not caught, which may yield interesting results.

That's not a thorough analysis, but it is a start.

-- 
Mark H. Wood
Lead Technology Analyst

University Library
Indiana University - Purdue University Indianapolis
755 W. Michigan Street
Indianapolis, IN 46202
317-274-0749
www.ulib.iupui.edu

-- 
All messages to this mailing list should adhere to the DuraSpace Code of 
Conduct: https://duraspace.org/about/policies/code-of-conduct/
--- 
You received this message because you are subscribed to the Google Groups 
"DSpace Technical Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dspace-tech+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dspace-tech/20200220144945.GC1294%40IUPUI.Edu.


signature.asc
Description: PGP signature


[dspace-tech] Re: LDAPAuthentication - can't create ePerson at DEBUG

2020-02-20 Thread Humberto Blanco Castillo
michael , got any response for this issue? i have the same problem in 
dspace 6.3 xmlui


El martes, 14 de noviembre de 2017, 8:41:40 (UTC-5), Michael White escribió:
>
> Hi,
>
>  
>
> DSpace v6.2, JSPUI . . .
>
>  
>
> I've been working to set up (hierarchical) LDAP based authentication on my 
> DSpace v6.2 DEV system but I'm having problems getting the system to 
> auto-create an ePerson record for new users when the log level is set to 
> DEBUG. In this case, the authentication/creation of the new ePerson fails, 
> and an "EmptyStackException" is thrown when (as far as I can tell) the 
> system attempts to restore the Authorisation state.
>
>  
>
> With the log level set at INFO, it all works as expected - the new user is 
> authenticated and then the ePerson record is created and the user is logged 
> in - here is a log snippet showing this working as expected at INFO:
>
>  
>
> 2017-11-14 13:20:22,462 INFO  org.dspace.authenticate.LDAPAuthentication @ 
> anonymous:session_id=AEFB43EF410423BD73812BA53CFDC825:ip_addr=139.153.86.2:auth:attempting
>  
> trivial auth of user=mmw2
>
> 2017-11-14 13:20:22,584 INFO  org.dspace.authenticate.LDAPAuthentication @ 
> anonymous:session_id=AEFB43EF410423BD73812BA53CFDC825:ip_addr=139.153.86.2:autoregister:netid=mmw2
>
> 2017-11-14 13:20:22,597 INFO  org.dspace.eperson.EPersonServiceImpl @ 
> anonymous:session_id=AEFB43EF410423BD73812BA53CFDC825:ip_addr=139.153.86.2:create_eperson:eperson_id=5955e86d-726f-4ea2-a28d-df92d73aaf15
>
> 2017-11-14 13:20:22,680 INFO  org.dspace.eperson.EPersonServiceImpl @ 
> anonymous:session_id=AEFB43EF410423BD73812BA53CFDC825:ip_addr=139.153.86.2:update_eperson:eperson_id=5955e86d-726f-4ea2-a28d-df92d73aaf15
>
> 2017-11-14 13:20:22,750 INFO  org.dspace.authenticate.LDAPAuthentication @ 
> mike.wh...@stir.ac.uk:session_id=AEFB43EF410423BD73812BA53CFDC825:ip_addr=139.153.86.2:authenticate:type=ldap-login,
>  
> created ePerson
>
> 2017-11-14 13:20:22,751 WARN  org.dspace.core.Context @ 
> mike.wh...@stir.ac.uk:session_id=AEFB43EF410423BD73812BA53CFDC825:ip_addr=139.153.86.2:restore_auth_sys_state:not
>  
> previous state info available null
>
> 2017-11-14 13:20:22,752 INFO  org.dspace.eperson.EPersonServiceImpl @ 
> mike.wh...@stir.ac.uk:session_id=AEFB43EF410423BD73812BA53CFDC825:ip_addr=139.153.86.2:update_eperson:eperson_id=5955e86d-726f-4ea2-a28d-df92d73aaf15
>
> 2017-11-14 13:20:22,855 ERROR org.dspace.core.I18nUtil @ No language 
> specified for EPerson 5955e86d-726f-4ea2-a28d-df92d73aaf15
>
> 2017-11-14 13:20:22,856 INFO  org.dspace.app.webui.servlet.LDAPServlet @ 
> mike.wh...@stir.ac.uk:session_id=AEFB43EF410423BD73812BA53CFDC825:ip_addr=139.153.86.2:login:type=explicit
>
> 2017-11-14 13:20:22,991 INFO  org.dspace.app.webui.servlet.MyDSpaceServlet 
> @ 
> mike.wh...@stir.ac.uk:session_id=923FB17CB27F83101481AD719C33997B:ip_addr=139.153.86.2:view_mydspace:
>
>  
>
>  
>
> However, with the log level at DEBUG, this fails with the reported 
> Exception:
>
>  
>
> 2017-11-14 13:14:43,178 DEBUG org.dspace.app.webui.servlet.DSpaceServlet @ 
> anonymous:session_id=FD5A8F4BFB2A5A8B1EC70A560831F10A:ip_addr=139.153.86.2:http_request:--
>  
> URL Was\colon; http\colon;//dspace6dev.stir.ac.uk
> \colon;8080/jspui/ldap-login
>
> -- Method\colon; POST
>
> -- Parameters were\colon;
>
> -- login_netid\colon; "mmw2"
>
> -- login_password\colon; *not logged*
>
> -- login_submit\colon; "Log In"
>
>  
>
> 2017-11-14 13:14:43,178 DEBUG org.dspace.core.LegacyPluginServiceImpl @ 
> Adding Sequence plugin for interface= 
> org.dspace.authenticate.AuthenticationMethod, 
> class=org.dspace.authenticate.LDAPAuthentication
>
> 2017-11-14 13:14:43,178 DEBUG org.dspace.core.LegacyPluginServiceImpl @ 
> Adding Sequence plugin for interface= 
> org.dspace.authenticate.AuthenticationMethod, 
> class=org.dspace.authenticate.PasswordAuthentication
>
> 2017-11-14 13:14:43,179 INFO  org.dspace.authenticate.LDAPAuthentication @ 
> anonymous:session_id=FD5A8F4BFB2A5A8B1EC70A560831F10A:ip_addr=139.153.86.2:auth:attempting
>  
> trivial auth of user=mmw2
>
> 2017-11-14 13:14:43,283 DEBUG org.dspace.authenticate.LDAPAuthentication @ 
> anonymous:session_id=FD5A8F4BFB2A5A8B1EC70A560831F10A:ip_addr=139.153.86.2:got
>  
> DN:CN=mmw2,OU=Enabled,OU=Staff,dc=ad,dc=stir,dc=ac,dc=uk
>
> 2017-11-14 13:14:43,292 INFO  org.dspace.authenticate.LDAPAuthentication @ 
> anonymous:session_id=FD5A8F4BFB2A5A8B1EC70A560831F10A:ip_addr=139.153.86.2:autoregister:netid=mmw2
>
> 2017-11-14 13:14:43,310 INFO  org.dspace.eperson.EPersonServiceImpl @ 
> anonymous:session_id=FD5A8F4BFB2A5A8B1EC70A560831F10A:ip_addr=139.153.86.2:create_eperson:eperson_id=b4a43809-a530-4f26-b300-7910e13ad76e
>
> 2017-11-14 13:14:43,351 DEBUG org.dspace.identifier.IdentifierServiceImpl 
> @ Found identifiers: []
>
> 2017-11-14 13:14:43,352 DEBUG org.dspace.content.DSpaceObjectServiceImpl @ 
> .
>
> 2017-11-14 13:14:43,370 DEBUG org.dspace.core.LegacyPluginServiceImpl @ 
> Adding Sequence plugin for interface= 
> 

[dspace-tech] RE: LDAPAuthentication - can't create ePerson at DEBUG

2017-11-16 Thread Michael White
Hi,

> I will continue to investigate, but wondered if anyone else out there had hit 
> this and, if so, how did you work around it

Just for the record, and in the absence of any better suggestions, I've worked 
around this by commenting out the following block in 
[dspace-src]/dspace-api/src/main/java/org/dspace/core/Context.java (around line 
303):


/*

if (log.isDebugEnabled())

{

  Thread currThread = Thread.currentThread();

  StackTraceElement[] stackTrace = currThread.getStackTrace();

  String caller = stackTrace[stackTrace.length - 1].getClassName();



  String previousCaller = (String) authStateClassCallHistory.pop();



  // if previousCaller is not the current caller *only* log a warning

  if (!previousCaller.equals(caller))

  {

log

  .warn(LogManager

.getHeader(

  this,

  "restore_auth_sys_state",

  "Class: "

+ caller

+ " call restore but previous state change 
made by "

+ previousCaller));

  }

}

*/

- and I'm now able to create a new user when logging on via LDAP with the log 
level set to DEBUG.

Of course, if anyone has any better suggestions, I'm all ears :)

Cheers,

Mike

Michael White
Senior Developer
Business Applications and Integrations

T: (01786) 466877
E: michael.wh...@stir.ac.uk
A: G5, Airthrey Castle, University of Stirling, Stirling, FK9 4LA

From: Michael White
Sent: 14 November 2017 13:41
To: dspace-tech@googlegroups.com
Subject: LDAPAuthentication - can't create ePerson at DEBUG

Hi,

DSpace v6.2, JSPUI . . .

I've been working to set up (hierarchical) LDAP based authentication on my 
DSpace v6.2 DEV system but I'm having problems getting the system to 
auto-create an ePerson record for new users when the log level is set to DEBUG. 
In this case, the authentication/creation of the new ePerson fails, and an 
"EmptyStackException" is thrown when (as far as I can tell) the system attempts 
to restore the Authorisation state.

With the log level set at INFO, it all works as expected - the new user is 
authenticated and then the ePerson record is created and the user is logged in 
- here is a log snippet showing this working as expected at INFO:

2017-11-14 13:20:22,462 INFO  org.dspace.authenticate.LDAPAuthentication @ 
anonymous:session_id=AEFB43EF410423BD73812BA53CFDC825:ip_addr=139.153.86.2:auth:attempting
 trivial auth of user=mmw2
2017-11-14 13:20:22,584 INFO  org.dspace.authenticate.LDAPAuthentication @ 
anonymous:session_id=AEFB43EF410423BD73812BA53CFDC825:ip_addr=139.153.86.2:autoregister:netid=mmw2
2017-11-14 13:20:22,597 INFO  org.dspace.eperson.EPersonServiceImpl @ 
anonymous:session_id=AEFB43EF410423BD73812BA53CFDC825:ip_addr=139.153.86.2:create_eperson:eperson_id=5955e86d-726f-4ea2-a28d-df92d73aaf15
2017-11-14 13:20:22,680 INFO  org.dspace.eperson.EPersonServiceImpl @ 
anonymous:session_id=AEFB43EF410423BD73812BA53CFDC825:ip_addr=139.153.86.2:update_eperson:eperson_id=5955e86d-726f-4ea2-a28d-df92d73aaf15
2017-11-14 13:20:22,750 INFO  org.dspace.authenticate.LDAPAuthentication @ 
mike.wh...@stir.ac.uk:session_id=AEFB43EF410423BD73812BA53CFDC825:ip_addr=139.153.86.2:authenticate:type=ldap-login,
 created ePerson
2017-11-14 13:20:22,751 WARN  org.dspace.core.Context @ 
mike.wh...@stir.ac.uk:session_id=AEFB43EF410423BD73812BA53CFDC825:ip_addr=139.153.86.2:restore_auth_sys_state:not
 previous state info available null
2017-11-14 13:20:22,752 INFO  org.dspace.eperson.EPersonServiceImpl @ 
mike.wh...@stir.ac.uk:session_id=AEFB43EF410423BD73812BA53CFDC825:ip_addr=139.153.86.2:update_eperson:eperson_id=5955e86d-726f-4ea2-a28d-df92d73aaf15
2017-11-14 13:20:22,855 ERROR org.dspace.core.I18nUtil @ No language specified 
for EPerson 5955e86d-726f-4ea2-a28d-df92d73aaf15
2017-11-14 13:20:22,856 INFO  org.dspace.app.webui.servlet.LDAPServlet @ 
mike.wh...@stir.ac.uk:session_id=AEFB43EF410423BD73812BA53CFDC825:ip_addr=139.153.86.2:login:type=explicit
2017-11-14 13:20:22,991 INFO  org.dspace.app.webui.servlet.MyDSpaceServlet @ 
mike.wh...@stir.ac.uk:session_id=923FB17CB27F83101481AD719C33997B:ip_addr=139.153.86.2:view_mydspace:


However, with