Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shibboleth: Remote Authentication Phase 1 #3025

Merged
merged 74 commits into from
May 13, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
7ea6a01
Shib: stub out migrate to builtin account #2915 #2939
pdurbin Feb 12, 2016
4121376
Shib: help should point at guides.dataverse.org #2951 #2939
pdurbin Feb 12, 2016
b317365
user page: when viewing show authenticated not builtin values #2046 #…
pdurbin Feb 23, 2016
040a4d4
Cleaned up the Account pg and messaging for Shibboleth users. Added e…
mheppler Feb 23, 2016
2c0cdec
Shib login page: remove "Help" link #2951
pdurbin Feb 23, 2016
bf2f824
add extra text below "Institution Log In" #2951 #2939
pdurbin Feb 23, 2016
51d15f8
Revised text for Shibboleth users on the Account Information pg, adde…
mheppler Feb 23, 2016
204831d
Cleaned up layout of the Shib and Account Information pgs and updated…
mheppler Feb 24, 2016
aa5391a
Fixed HTML rendering issue with help text in Institution Log In block…
mheppler Feb 25, 2016
f328110
editMode honors :AllowSignup boolean #2838 #2939
pdurbin Mar 1, 2016
901e804
Fixed styling for the warning msg in the Request Access popup on the …
mheppler Mar 1, 2016
ffd1d6e
Shib: pick first email if multiple asserted #2512 #2939
pdurbin Mar 2, 2016
f901d9f
Shib: add more debug logging #2916 #2939
pdurbin Mar 3, 2016
66c4777
all users can have an affiliation #2950 #2939
pdurbin Mar 3, 2016
58ed4f8
Shib: don't tell users IdP didn't give affiliation #2950 #2939
pdurbin Mar 3, 2016
8471c02
add tests for non-ASCII email validation #2998
pdurbin Mar 4, 2016
96adc39
redirect Shib users to page they clicked #1551 #2939
pdurbin Mar 4, 2016
2d5130c
Shib: disable redirect fix in 96adc39 in #1551 #2939
pdurbin Mar 7, 2016
e911234
Shib: after convert, show user page #2952 #2939
pdurbin Mar 7, 2016
21bd0e8
improved Shibboleth docs #2953 #2939
pdurbin Mar 8, 2016
0b212f8
API: add endpoint for listing users #3009 #2939
pdurbin Mar 9, 2016
8e7d93a
Added Institutional Log In section for shibboleth
eaquigley Mar 10, 2016
cdb8cca
Update account.rst
eaquigley Mar 10, 2016
a906486
handle http://api.randomuser.me downtime #2939
pdurbin Mar 14, 2016
fe0d14d
Shib refactor getRandomUser (no-op) #2939
pdurbin Mar 14, 2016
c76e67d
Shib: move getAffiliation from backing to service bean #2939
pdurbin Mar 14, 2016
0d1cc9b
Shib: refactor to exercise getAffiliation from API #2939
pdurbin Mar 14, 2016
b54ef59
Shib refactor: move builtin2shib to AdminIT #2939
pdurbin Mar 14, 2016
1b74d2e
Shib: move English text to bundle #2939
pdurbin Mar 14, 2016
0672ddd
Shib: refactor and make more testable #2939
pdurbin Mar 15, 2016
7943bcc
Shib: remove headers experiment (insecure) #2939 #2294
pdurbin Mar 15, 2016
5c19ca0
Shib: remove old debugging code #2916 #2939
pdurbin Mar 15, 2016
bcb8ef2
Shib: move more methods out of backing bean #2939
pdurbin Mar 15, 2016
b6c638d
Shibboleth: favor "Institutional" login #3011 #2939
pdurbin Mar 15, 2016
ea046a3
Merge branch 'develop' into 2939-shib #2939
pdurbin Mar 16, 2016
15e15d1
refix "institutional" and blurb #2951 #3011 #2939
pdurbin Mar 16, 2016
67cb710
Added screenshots for #2975
posixeleni Mar 17, 2016
89272c3
Checking to see if images are working properly
eaquigley Mar 17, 2016
c712826
Update images #2975
posixeleni Mar 17, 2016
64f3c58
forgot some formatting
eaquigley Mar 17, 2016
2859eb5
Adding screenshots to #2975
posixeleni Mar 17, 2016
bac238f
Merge branch 'develop' into 2939-shib #2939
pdurbin Mar 17, 2016
541ffba
Grammar and punctuation fixed.
bencook Mar 18, 2016
775abe2
Merge pull request #3027 from bencook/patch-1
pdurbin Mar 21, 2016
0a5a677
Shib: add "Learn More" link to User Guide account page #2951
pdurbin Mar 21, 2016
db3f4f6
Merge branch 'develop' into 2939-shib #2939
pdurbin Mar 23, 2016
78ef2c1
Merge branch 'develop' into 2939-shib #2939
pdurbin Mar 24, 2016
4d332e0
Shib Install Guide #2953
pdurbin Mar 28, 2016
643e455
Shib: use correct builtin creds for conversion #3045
pdurbin Mar 30, 2016
af72a7b
Shib: turn down logging #2916 #3034
pdurbin Mar 30, 2016
28b65ea
add shib and auth users endpoints to API docs #3037
pdurbin Apr 1, 2016
56f14ee
#3041 Add runtime groups (shib, ip) to MyData page
sekmiller Apr 1, 2016
c6f641f
Merge branch 'develop' into 2939-shib #2939
pdurbin Apr 1, 2016
67007b5
#3041 fix user identifier for individual role lookup
sekmiller Apr 1, 2016
2c98602
Merge branch 'develop' into 2939-shib #2939
pdurbin Apr 19, 2016
656a074
support popup: revert 51d15f8 (regression) #3036
pdurbin Apr 19, 2016
707f2ba
Shib: keep "random" user working #3025
pdurbin Apr 19, 2016
adf1e34
support form: no more PF in bundle #3036
pdurbin Apr 19, 2016
5edf6a3
Shib: clean up section on identity federations #2937
pdurbin Apr 19, 2016
083f279
support popup fix for welcome notification #2966 #3036
pdurbin Apr 19, 2016
850bceb
new Shib users should get welcome notification too #3080
pdurbin Apr 19, 2016
951359c
Shib: API test and javadoc cleanup (no-op) #3025
pdurbin Apr 21, 2016
936a5fb
h2 for both local and shib login #3085
pdurbin Apr 25, 2016
a32c290
Shib: on create, redirect to account info page #3085
pdurbin Apr 25, 2016
e195cbb
Shib conversion: update messages per #3085
pdurbin Apr 25, 2016
0e08dca
API Token: turn page into tab on account page #3086 #3025 #2841
pdurbin Apr 25, 2016
c979314
change to "Dataverse Account Log In" #3085
pdurbin Apr 26, 2016
84416ab
API Token: localize tab #3086
pdurbin Apr 26, 2016
6972401
Updated text for #3086
eaquigley Apr 27, 2016
7db7117
update user guide to reflect API Token updates
eaquigley Apr 27, 2016
3b5503e
API Token: add to header #3086
pdurbin Apr 27, 2016
962997e
API Token: put "not found" message in bundle and update #2939
pdurbin Apr 27, 2016
5dba82d
consistent capitalization of "API Token" #3086
pdurbin Apr 27, 2016
fe5b00d
Merge branch 'develop' into 2939-shib
pdurbin May 12, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added doc/Sphinx/source/img/image1institutional.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/Sphinx/source/img/image2institutional.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/Sphinx/source/img/image3institutional.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/Sphinx/source/img/image4institutional.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<VirtualHost *:80>

ServerName shibtest.dataverse.org
ServerName dataverse.example.edu

# From https://wiki.apache.org/httpd/RewriteHTTPToHTTPS

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ SSLCryptoDevice builtin

# General setup for the virtual host, inherited from global configuration
#DocumentRoot "/var/www/html"
ServerName shibtest.dataverse.org:443
ServerName dataverse.example.edu:443

# Use separate log files for the SSL virtual host; note that LogLevel
# is not inherited from httpd.conf.
Expand All @@ -102,14 +102,14 @@ SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW
# the certificate is encrypted, then you will be prompted for a
# pass phrase. Note that a kill -HUP will prompt again. A new
# certificate can be generated using the genkey(1) command.
SSLCertificateFile /etc/pki/tls/certs/shibtest.dataverse.org.crt
SSLCertificateFile /etc/pki/tls/certs/dataverse.example.edu.crt

# Server Private Key:
# If the key is not combined with the certificate, use this
# directive to point at the key file. Keep in mind that if
# you've both a RSA and a DSA private key you can configure
# both in parallel (to also allow the use of DSA ciphers, etc.)
SSLCertificateKeyFile /etc/pki/tls/private/shibtest.dataverse.org.key
SSLCertificateKeyFile /etc/pki/tls/private/dataverse.example.edu.key

# Server Certificate Chain:
# Point SSLCertificateChainFile at a file containing the
Expand All @@ -118,7 +118,7 @@ SSLCertificateKeyFile /etc/pki/tls/private/shibtest.dataverse.org.key
# the referenced file can be the same as SSLCertificateFile
# when the CA certificates are directly appended to the server
# certificate for convinience.
SSLCertificateChainFile /etc/pki/tls/certs/shibtest.dataverse.org_server-chain.crt
SSLCertificateChainFile /etc/pki/tls/certs/dataverse.example.edu_server-chain.crt

# Certificate Authority (CA):
# Set the CA certificate verification path where to find CA
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "All testshib.org Shibboleth Users",
"attribute": "Shib-Identity-Provider",
"pattern": "https://idp.testshib.org/idp/shibboleth"
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPConfiguration
clockSkew="1800">

<!-- FIXME: change the entityID to your hostname. -->
<ApplicationDefaults entityID="https://shibtest.dataverse.org/sp"
<ApplicationDefaults entityID="https://dataverse.example.edu/sp"
REMOTE_USER="eppn" attributePrefix="AJP_">

<!-- You should use secure cookies if at all possible. See cookieProps in this Wiki article. -->
Expand All @@ -30,7 +30,7 @@ https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPConfiguration
<!--
Handlers allow you to interact with the SP and gather more information. Try them out!
Attribute values received by the SP through SAML will be visible at:
http://shibtest.dataverse.org/Shibboleth.sso/Session
http://dataverse.example.edu/Shibboleth.sso/Session
-->

<!-- Extension service that generates "approximate" metadata based on SP configuration. -->
Expand Down
29 changes: 28 additions & 1 deletion doc/sphinx-guides/source/api/native-api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,10 @@ Remove a single role assignee from an explicit group::

DELETE http://$server/api/dataverses/$dv/groups/$groupAlias/roleAssignees/$roleAssigneeIdentifier

Shibboleth Groups
~~~~~~~~~~~~~~~~~

Management of Shibboleth groups via API is documented in the :doc:`/installation/shibboleth` section of the Installation Guide.

Metadata Blocks
~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -309,7 +312,31 @@ Creates a global role in the Dataverse installation. The data POSTed are assumed

POST http://$SERVER/api/admin/roles

Toggles superuser mode on the ``AuthenticatedUser`` whose ``identifier`` is passed. ::
List all users::

GET http://$SERVER/api/admin/authenticatedUsers

List user whose ``identifier`` (without the ``@`` sign) is passed::

GET http://$SERVER/api/admin/authenticatedUsers/$identifier

Sample output using "dataverseAdmin" as the ``identifier``::

{
"authenticationProviderId": "builtin",
"persistentUserId": "dataverseAdmin",
"position": "Admin",
"id": 1,
"identifier": "@dataverseAdmin",
"displayName": "Dataverse Admin",
"firstName": "Dataverse",
"lastName": "Admin",
"email": "dataverse@mailinator.com",
"superuser": true,
"affiliation": "Dataverse.org"
}

Toggles superuser mode on the ``AuthenticatedUser`` whose ``identifier`` (without the ``@`` sign) is passed. ::

POST http://$SERVER/api/admin/superuser/$identifier

Expand Down
254 changes: 197 additions & 57 deletions doc/sphinx-guides/source/installation/shibboleth.rst

Large diffs are not rendered by default.

56 changes: 47 additions & 9 deletions doc/sphinx-guides/source/user/account.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ Account Creation & Management

As a registered user, you can:

- Create your own dataverse and customize it.
- Create your own dataverse and customize it
- Add datasets to dataverses, if available
- Contribute to existing datasets, if available
- Request access to restricted files, if available.
- Request access to restricted files, if available

Create User Account
===================
Expand All @@ -17,18 +17,50 @@ Create User Account
Edit Your Account
==================
#. To edit your account after you have logged in, click on your account name in the header on the right hand side and click on Account Information.
#. On the top right of your account page, click on the "Edit Account" button and from there you can select to edit either your Account Information or your Account Password.
#. On the top right of your account page, click on the "Edit Account" button and from there you can select to edit either your Account Information or your Account Password.
#. Select "Save Changes" when you are done.

Generate Your API Token
Institutional Log In
========================
#. To generate your API token, click on your name in the hearder on right hand side and then click on Account Information.
#. On the top right of your account page, click on the "Edit Account" button and click on API Token in the list.
#. Your API Token is located on that page.


Institutional log in allows you to use your log in information for your university (e.g. HarvardKey at Harvard) to log into your Dataverse account. By using your institutional log in, you won't have to remember your password for Dataverse or manage another account.

How to create a new Dataverse account using Institutional Log In
-------------------------------------------------------------------------------------------------

#. Go to “Log In” in the upper right corner of Dataverse.
#. Find this Institutional Log In box:|image1|
#. Using the dropdown menu, select your institution then click the Continue button.
#. You will be brought to your institution's log in page. After you put in your institutional information successfully, you will be brought back to Dataverse to confirm your account. |image2|

How to use your Institutional Log In for your Dataverse account
-------------------------------------------------------------------------------------------------

If you already have a Dataverse account, but you want to change it to use your institutional log in, you can easily do so as long as your account uses an email address from that institution.

#. Go to the Account Information page to confirm your account email address is the same as your institution email address. If not, you will need to update your account email address to be the same as your institution email address.
#. Log out of Dataverse.
#. Go to “Log In” in the upper right corner of Dataverse.
#. Find this Institutional Log In box: |image1|
#. Using the dropdown menu, select your institution then click the Continue button.
#. You will be brought to your institution's log in page. After you successfully input your institutional information, you will be brought back to Dataverse to review your account information. Enter your previous password for your Dataverse account to ensure that you have changed your login. |image3|
#. Once you click Change/Convert Account, you will have completed changing your Dataverse account to you use your institutional log in.

How to change your Dataverse account to no longer use Institutional Log In
-------------------------------------------------------------------------------------------------

If you are leaving your institution and need to change your account back to a Dataverse account, you will need to contact support for the Dataverse installation you are using. On your account page, there is a link that will open the contact form for Support: |image4|


Create Your API Token
========================
#. To create your API token, click on your name in the header on right hand side and then click on API Token.
#. In this tab, you can create your API Token for the first time as well as recreate it if you need a new API Token or your API Token becomes compromised.

My Data
========================
The My Data section of your account page displays a listing of all the dataverses, datasets, and files you have either created, uploaded or that you have access to edit. You are able to filter through all the dataverses, datasets, and files listed there using the filter box or use the facets on the left side to only view a specific Publication Status or Role.
The My Data section of your account page displays a listing of all the dataverses, datasets, and files you have either created, uploaded or that you have access to edit. You are able to filter through all the dataverses, datasets, and files listed there using the filter box. You may also use the facets on the left side to only view a specific Publication Status or Role.

Notifications: Setup & Maintainance
===================================
Expand All @@ -44,6 +76,12 @@ Dataverse will email your unread notifications once a day. Notifications will on

Reset Your Account Password
==============================
If you cannot remember the password for your Dataverse account, click on Log In in the top right corner of any page. Once on that page, click on the Forgot Password? link below where you would enter your username and password. Enter your email address and click Submit Password Request to receive an email with a link to reset your password.
If you cannot remember the password for your Dataverse account, click on Log In in the top right corner of any page. Once on that page, click on the "Forgot Password?" link below where you would enter your username and password. Enter your email address and click "Submit Password Request" to receive an email with a link to reset your password.

\*Note: if you have forgotten your username, you can do this same process to receive your username in an email.


.. |image1| image:: ./img/image1institutional.png
.. |image2| image:: ./img/image2institutional.png
.. |image3| image:: ./img/image3institutional.png
.. |image4| image:: ./img/image4institutional.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,11 @@
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.5.201505241946</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>1.10.19</version>
</dependency>
<!-- Added for DataCite -->
<dependency>
<groupId>org.slf4j</groupId>
Expand Down
38 changes: 25 additions & 13 deletions src/main/java/Bundle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ header.logOut=Log Out
header.accountInfo=Account Information
header.user.selectTab.dataRelated=My Data
header.user.selectTab.notifications=Notifications
header.user.selectTab.accountInfo=Account Information
header.user.selectTab.groupsAndRoles=Groups + Roles
header.user.selectTab.apiToken=API Token

# dataverse_template.xhtml

Expand Down Expand Up @@ -116,8 +118,10 @@ contact.contact=Contact

account.info=Account Information
account.edit=Edit Account
apiTaken=API Token
user.toEditDetail=You are logged in through your institution. If you need to update any of this information, please contact your institution.
account.apiToken=API Token
user.isShibUser=Account information cannot be edited when logged in through an institutional account.
user.helpShibUserMigrateOffShibBeforeLink=Leaving your institution? Please contact
user.helpShibUserMigrateOffShibAfterLink=for assistance.
user.lostPasswdTip=If you have lost or forgotten your password, please enter your username or email address below and click Submit. We will send you an e-mail with your new password.
user.dataRelatedToMe=My Data
wasCreatedIn=, was created in
Expand Down Expand Up @@ -181,29 +185,37 @@ user.updatePassword.password=Create a password that is minimum six characters lo
authenticationProvidersAvailable.tip={0}There are no active authentication providers{1}If you are a system administrator, please enable one using the API.{2}If you are not a system administrator, please contact the one for your institution.
login.System=Login System
login.forgot.text=Forgot your password?
login.institution=Institution Log In
login.builtin=Dataverse Account Log In
login.institution=Institutional Log In
login.institution.blurb=Use Dataverse with your institutional log in instead of creating an account. <a href="{0}/{1}/user/account.html" target="_blank">Learn More</a>.
login.institution.support.beforeLink=Leaving your institution? Please contact
login.institution.support.afterLink=for assistance.
login.builtin.credential.usernameOrEmail=Username/Email
login.builtin.credential.password=Password
login.builtin.invalidUsernameEmailOrPassword=The username, email address, or password you entered is invalid. Need assistance accessing your account?
# how do we exercise login.error? Via a password upgrade failure? See https://github.com/IQSS/dataverse/pull/2922
login.error=Error validating the username, email address, or password. Please try again. If the problem persists, contact an administrator.

#shib.xhtml
shib.btn.acceptAndConvert=Accept Terms and Convert Account
shib.btn.acceptAndCreate=Accept Terms and Create Account
shib.welcome=Welcome,
shib.welcomeExistingUserMessage=The email provided by {0} authentication matches an existing Dataverse account. If you would like to associate your existing Dataverse account with {0} authentication, please enter the password of your existing Dataverse account, review the General Terms of Use, and then click the Accept Terms and Convert Account button.
shib.btn.convertAccount=Convert Account
shib.btn.createAccount=Create Account
shib.askToConvert=Would you like to convert your Dataverse account to always use your institutional log in?
# Bundle file editors, please note that "shib.welcomeExistingUserMessage" is used in a unit test
shib.welcomeExistingUserMessage=Your institutional log in for {0} matches an email address already being used for a Dataverse account. By entering your current Dataverse password below, your existing Dataverse account can be converted to use your institutional log in. After converting, you will only need to use your institutional log in.
# Bundle file editors, please note that "shib.welcomeExistingUserMessageDefaultInstitution" is used in a unit test
shib.welcomeExistingUserMessageDefaultInstitution=your institution
shib.dataverseUsername=Dataverse Username
shib.currentDataversePassword=Current Dataverse Password
shib.accountInformation=Account Information
shib.offerToCreateNewAccount=Please agree to the Dataverse Terms of Use to create your account.
shib.passwordRejected=Your account can only be converted if you provide the correct password for your existing account.
shib.offerToCreateNewAccount=This information is provided by your institution and will be used to create your Dataverse account.
shib.passwordRejected=<strong>Validation Error</strong> - Your account can only be converted if you provide the correct password for your existing account.

#apitoken.xhtml
# tab on dataverseuser.xhtml
apitoken.title=API Token
apitoken.message=Here is your API Token. Check out our {0}API Guide{1} for more information.
apitoken.generateBtn=Generate Token
apitoken.regenerateBtn=Regenerate Token
apitoken.message=Your API Token is displayed below after it has been created. Check out our {0}API Guide{1} for more information on using your API Token with the Dataverse APIs.
apitoken.notFound=API Token for {0} has not been created.
apitoken.generateBtn=Create Token
apitoken.regenerateBtn=Recreate Token

#MailServiceBean.java

Expand Down
14 changes: 11 additions & 3 deletions src/main/java/edu/harvard/iq/dataverse/ApiTokenPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,21 @@
import edu.harvard.iq.dataverse.authorization.AuthenticationServiceBean;
import edu.harvard.iq.dataverse.authorization.users.ApiToken;
import edu.harvard.iq.dataverse.authorization.users.AuthenticatedUser;
import static edu.harvard.iq.dataverse.util.JsfHelper.JH;
import edu.harvard.iq.dataverse.util.BundleUtil;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import java.util.logging.Logger;
import javax.ejb.EJB;
import javax.faces.application.FacesMessage;
import javax.faces.view.ViewScoped;
import javax.inject.Inject;
import javax.inject.Named;

/**
* @todo Rename this to ApiTokenFragment? The separate page is being taken out
* per https://github.com/IQSS/dataverse/issues/3086
*/
@ViewScoped
@Named("ApiTokenPage")
public class ApiTokenPage implements java.io.Serializable {
Expand Down Expand Up @@ -45,9 +50,12 @@ public String getApiToken() {
if (apiToken != null) {
return apiToken.getTokenString();
} else {
return "API token for " + au.getName() + " not found";
List<String> arguments = new ArrayList<>();
arguments.add(au.getName());
return BundleUtil.getStringFromBundle("apitoken.notFound", arguments);
}
} else {
// It should be impossible to get here from the UI.
return "Only authenticated users can have API tokens.";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,31 +265,4 @@ public DvObject getDvObject() {
}

}

private Boolean debugShibboleth = null;

public boolean isDebugShibboleth() {
if (debugShibboleth != null) {
return debugShibboleth;
}
debugShibboleth = systemConfig.isDebugEnabled();
return debugShibboleth;
}

public List<String> getGroups(User user) {
List<String> groups = new ArrayList<>();
Set<Group> groupsForUser = groupService.groupsFor(user, null);
for (Group group : groupsForUser) {
groups.add(group.getDisplayName() + " (" + group.getIdentifier() + ")");
}
return groups;
}

public List<String> getPermissions(User user, Dataverse dataverse) {
List<String> permissions = new ArrayList<>();
for (Permission permission : permissionService.permissionsFor(user, dataverse)) {
permissions.add(permission.name());
}
return permissions;
}
}
11 changes: 10 additions & 1 deletion src/main/java/edu/harvard/iq/dataverse/EMailValidator.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,18 @@ public static boolean isEmailValid(String value, ConstraintValidatorContext cont
//we'll let someone else decide if it's required
return true;
}
/**
* @todo Why are we validating the trimmed value rather than the value
* itself? Which are we persisting to the database, the trimmed value or
* the non-trimmed value? See also
* https://github.com/IQSS/dataverse/issues/2945 and
* https://github.com/IQSS/dataverse/issues/3044
*/
boolean isValid = EmailValidator.getInstance().isValid(value.trim());
if (!isValid) {
context.buildConstraintViolationWithTemplate(value + " is not a valid email address.").addConstraintViolation();
if (context != null) {
context.buildConstraintViolationWithTemplate(value + " is not a valid email address.").addConstraintViolation();
}
return false;
}
return true;
Expand Down
Loading