Class EdalHelpers
- java.lang.Object
-
- de.ipk_gatersleben.bit.bi.edal.sample.EdalHelpers
-
public class EdalHelpers extends java.lang.Object
Provide some helpful function for the first experience with eDAL.
-
-
Constructor Summary
Constructors Constructor Description EdalHelpers()
-
Method Summary
Modifier and Type Method Description static javax.security.auth.Subject
authenticateElixirUser(java.lang.String httpProxyHost, int httpProxyPort)
Authenticate user using theGoogleLoginModule
.static javax.security.auth.Subject
authenticateGoogleUser()
Authenticate user using theGoogleLoginModule
.static javax.security.auth.Subject
authenticateGoogleUser(java.lang.String httpProxyHost, int httpProxyPort)
Authenticate user using theGoogleLoginModule
.static javax.security.auth.Subject
authenticateIPKKerberosUser(java.lang.String user)
Authenticate user using the IPK Kerberos-LoginModule.static javax.security.auth.Subject
authenticateJKIKerberosUser(java.lang.String user)
Authenticate user using the JKI Kerberos-LoginModule.static javax.security.auth.Subject
authenticateORCIDUser(java.lang.String httpProxyHost, int httpProxyPort)
Authenticate user using theORCIDLoginModule
.static javax.security.auth.Subject
authenticateSampleUser()
Authenticate user using theSampleUserLoginModule
-LoginModule.static javax.security.auth.Subject
authenticateSubjectWithKerberos(java.lang.String kerberosRealm, java.lang.String kerberosKDC, java.lang.String user)
Authenticate user using the specified Kerberos-LoginModule.static javax.security.auth.Subject
authenticateUser(java.lang.String name, java.lang.String password)
Authenticate user using theUserLoginModule
-LoginModule.static javax.security.auth.Subject
authenticateWinOrUnixOrMacUser()
Authenticate user using the Windows- or Unix- or MAC-LoginModule.static void
cleanMountPath(java.nio.file.Path path)
Clean all files in directory.static ImplementationProvider
getFileSystemImplementationProvider(boolean cleanMountPathBefore, EdalConfiguration config)
Get a newFileSystemImplementationProvider
.static void
getSearchStatistic(org.hibernate.stat.Statistics statistics)
Print SearchStatistic.static void
getStatistic(org.hibernate.stat.Statistics statistics)
Print PermissionStatistic.static boolean
openURL(java.lang.String url)
Function to open a browser and loading the given URL.
-
-
-
Method Detail
-
authenticateGoogleUser
public static javax.security.auth.Subject authenticateGoogleUser() throws EdalAuthenticateException
Authenticate user using theGoogleLoginModule
.- Returns:
- the authenticated
Subject
- Throws:
EdalAuthenticateException
- if unable to runLoginModule
successful.
-
authenticateORCIDUser
public static javax.security.auth.Subject authenticateORCIDUser(java.lang.String httpProxyHost, int httpProxyPort) throws EdalAuthenticateException
Authenticate user using theORCIDLoginModule
.- Parameters:
httpProxyHost
- the address of the HTTP proxy hosthttpProxyPort
- the address of the HTTP proxy port- Returns:
- the authenticated
Subject
- Throws:
EdalAuthenticateException
- if unable to runLoginModule
successful.
-
authenticateElixirUser
public static javax.security.auth.Subject authenticateElixirUser(java.lang.String httpProxyHost, int httpProxyPort) throws EdalAuthenticateException
Authenticate user using theGoogleLoginModule
.- Parameters:
httpProxyHost
- the address of the HTTP proxy hosthttpProxyPort
- the address of the HTTP proxy port- Returns:
- the authenticated
Subject
- Throws:
EdalAuthenticateException
- if unable to runLoginModule
successful.
-
authenticateGoogleUser
public static javax.security.auth.Subject authenticateGoogleUser(java.lang.String httpProxyHost, int httpProxyPort) throws EdalAuthenticateException
Authenticate user using theGoogleLoginModule
.- Parameters:
httpProxyHost
- the address of the HTTP proxy hosthttpProxyPort
- the address of the HTTP proxy port- Returns:
- the authenticated
Subject
- Throws:
EdalAuthenticateException
- if unable to runLoginModule
successful.
-
authenticateIPKKerberosUser
public static javax.security.auth.Subject authenticateIPKKerberosUser(java.lang.String user) throws EdalAuthenticateException
Authenticate user using the IPK Kerberos-LoginModule.- Parameters:
user
- user name.- Returns:
- the authenticated
Subject
- Throws:
EdalAuthenticateException
- if unable to runLoginModule
successful.
-
authenticateJKIKerberosUser
public static javax.security.auth.Subject authenticateJKIKerberosUser(java.lang.String user) throws EdalAuthenticateException
Authenticate user using the JKI Kerberos-LoginModule.- Parameters:
user
- the user name to login- Returns:
- the authenticated
Subject
- Throws:
EdalAuthenticateException
- if unable to runLoginModule
successful.
-
authenticateUser
public static javax.security.auth.Subject authenticateUser(java.lang.String name, java.lang.String password) throws EdalAuthenticateException
Authenticate user using theUserLoginModule
-LoginModule.- Parameters:
name
- the user name to authenticatepassword
- the password of the user to authenticate- Returns:
- the authenticated
Subject
- Throws:
EdalAuthenticateException
- if unable to runLoginModule
successful.
-
authenticateSampleUser
public static javax.security.auth.Subject authenticateSampleUser() throws EdalAuthenticateException
Authenticate user using theSampleUserLoginModule
-LoginModule.- Returns:
- the authenticated
Subject
- Throws:
EdalAuthenticateException
- if unable to runLoginModule
successful.
-
authenticateSubjectWithKerberos
public static javax.security.auth.Subject authenticateSubjectWithKerberos(java.lang.String kerberosRealm, java.lang.String kerberosKDC, java.lang.String user) throws EdalAuthenticateException
Authenticate user using the specified Kerberos-LoginModule.- Parameters:
kerberosRealm
- the Kerberos realmkerberosKDC
- the Kerberos KDCuser
- optional username- Returns:
- the authenticated
Subject
- Throws:
EdalAuthenticateException
- if unable to runLoginModule
successful.
-
authenticateWinOrUnixOrMacUser
public static javax.security.auth.Subject authenticateWinOrUnixOrMacUser() throws EdalAuthenticateException
Authenticate user using the Windows- or Unix- or MAC-LoginModule.- Returns:
- authenticated
Subject
- Throws:
EdalAuthenticateException
- if the authentication failed
-
cleanMountPath
public static void cleanMountPath(java.nio.file.Path path) throws EdalException
Clean all files in directory.- Parameters:
path
- aPath
object.- Throws:
EdalException
- if unable to clean mount path.
-
getFileSystemImplementationProvider
public static ImplementationProvider getFileSystemImplementationProvider(boolean cleanMountPathBefore, EdalConfiguration config) throws EdalException
Get a newFileSystemImplementationProvider
. The path to use for file storage and database is set to users home/edal_test- Parameters:
cleanMountPathBefore
- true if you want to clean the database before start eDAL.config
- theEdalConfiguration
class.- Returns:
- new
FileSystemImplementationProvider
- Throws:
EdalException
- if unable to clean mount path or create new mount path.
-
getSearchStatistic
public static void getSearchStatistic(org.hibernate.stat.Statistics statistics)
Print SearchStatistic.- Parameters:
statistics
- theStatistics
to get information
-
getStatistic
public static void getStatistic(org.hibernate.stat.Statistics statistics)
Print PermissionStatistic.- Parameters:
statistics
- theStatistics
to get information
-
openURL
public static boolean openURL(java.lang.String url)
Function to open a browser and loading the given URL.- Parameters:
url
- the URL to open in a browser- Returns:
- true if the function was able to open the browser
-
-