Correct. Good Luck!

Shaun

On 2020/04/15 20:39, Jose Blanco wrote:
I was looking over the code, and this makes sense. Thank you.  I will give it a try.  I guess the method you are using in this code is PasswordAuthentication? Correct?
Thank you again!
-Jose

On Wed, Apr 15, 2020 at 2:31 PM Shaun donovan <[email protected] <mailto:[email protected]>> wrote:

    Hi Jose.

    To accomplish the same thing in 6.3, I had to add two new methods
    to
    
dspace-api/src/main/java/org/dspace/authenticate/AuthenticationServiceImpl.java:

    Line 74

    @Override
    public int authenticateSword(Context context, String un, String
    pw, String realm, HttpServletRequest request) {
    PasswordAuthentication AuthenticationMethod = new
    PasswordAuthentication();

    // better is lowest, so start with the highest.
    int bestRet = PasswordAuthentication.BAD_ARGS;

    // return on first success, otherwise "best" outcome.
    int ret = 0;
    try {
    ret = AuthenticationMethod.authenticate(context, un, pw, realm,
    request);
    } catch (SQLException e) {
    ret = PasswordAuthentication.NO_SUCH_USER;
    }
    if (ret == PasswordAuthentication.SUCCESS) {
    EPerson me = context.getCurrentUser();
    me.setLastActive(new Date());
    try {
    ePersonService.update(context, me);
    } catch (SQLException ex) {
    log.error("Could not update last-active stamp", ex);
    } catch (AuthorizeException ex) {
    log.error("Could not update last-active stamp", ex);
    }
    return ret;
    }
    if (ret < bestRet) {
    bestRet = ret;
    }
    return bestRet; And line 210: @Override
    public List<Group> getSpecialGroupsSword(Context context,
    HttpServletRequest request) throws SQLException{
    PasswordAuthentication method = new PasswordAuthentication();
    List<Group> result = new ArrayList<>();
    int totalLen = 0;
    List<Group> gl = method.getSpecialGroups(context, request);
    if (gl.size() > 0)
    {
    result.addAll(gl);
    totalLen += gl.size();
    }
    return result;
    Then I had to reference them in the interface
    
dspace-api/src/main/java/org/dspace/authenticate/service/AuthenticationService.java
    (line 188):
    public int authenticateSword(Context context, String un, String
    pw, String realm, HttpServletRequest request);
    public List<Group> getSpecialGroupsSword(Context context,
    HttpServletRequest request) throws SQLException;

    And lastly for swordv2 I had to use them in
    dspace-swordv2/src/main/java/org/dspace/sword2/SwordAuthenticator.java
    line 85-86
    |||int auth = authenticationService ||.authenticateSword(context, un, pw, null, null); 
Line 196-197 ||List<Group> specialGroups = authenticationService 
||.getSpecialGroupsSword(context, null); Line 228-229 ||List<Group> specialGroups = 
authenticationService |       |.getSpecialGroupsSword(oboContext, null); Rebuild and 
redeploy.
    If you want it for swordV1 as well, you will need to also make the
    last set of changes to
    dspace-sword/src/main/java/org/dspace/sword/SWORDAuthenticator.java
    as well as the following import: ||import 
org.dspace.authenticate.PasswordAuthentication; Please
    note that I did this to allow XMLUI to use my ADFS authentication
    while allowing Sword and SwordV2 to use password authentication.
    You will need to fix accordingly Hope this helps. Shaun |||||||||||

    On 2020/04/15 19:32, Jose Blanco wrote:
    In config/modules/authentication.cfg  I have indicated the auth
    method I want the system to use from the browser.

    *plugin.sequence.org.dspace.authenticate.AuthenticationMethod =
    org.dspace.authenticate.PasswordAuthentication*

    I want the system to use a different auth method when interacting
    with SWORDv2.  How do I go about doing this in 6.3?

    For 5.1, I duplicated some code to get that to work. But I think
    in this environment that would be more difficult, perhaps not
    even necessary?


    -Jose


-- 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 [email protected]
    <mailto:[email protected]>.
    To view this discussion on the web visit
    
https://groups.google.com/d/msgid/dspace-tech/CAK%3DKc-siPG1roGc8mAvWTQUCpA%2BVWmMvKypM%3DOuMx%3D%3DGAyA_gw%40mail.gmail.com
    
<https://groups.google.com/d/msgid/dspace-tech/CAK%3DKc-siPG1roGc8mAvWTQUCpA%2BVWmMvKypM%3DOuMx%3D%3DGAyA_gw%40mail.gmail.com?utm_medium=email&utm_source=footer>.

--
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 [email protected] <mailto:[email protected]>. To view this discussion on the web visit https://groups.google.com/d/msgid/dspace-tech/CAK%3DKc-t_PopRb6gx%2B%2BtbGBYAa8KsWZZ3Qm8gr6OcjWbh5kFNCQ%40mail.gmail.com <https://groups.google.com/d/msgid/dspace-tech/CAK%3DKc-t_PopRb6gx%2B%2BtbGBYAa8KsWZZ3Qm8gr6OcjWbh5kFNCQ%40mail.gmail.com?utm_medium=email&utm_source=footer>.

--
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dspace-tech/1294a766-84d3-9fda-591b-a85de1e71412%40teqcle.co.za.

Reply via email to