Fórum
Allow guest user to sign in to repository
h h, modificado 7 Anos atrás.
Allow guest user to sign in to repository
New Member Postagens: 4 Data de Entrada: 21/09/16 Postagens Recentes
Hi,
I am fairly new to liferay, and is working with the documents and media library in liferay 7 right now.
I registered a repository, and has already set up the portal properties to connect if the user is logged-in:
session.store.password=true
company.security.auth.type=screenName
This all work so far.
But here is the problem: I need guests to be able to connect as well, so I tried to hardcode a guest username and password in portal:
dl.repository.guest.username=guest
dl.repository.guest.password=guesttest
This doesn't seem to work.
I have already went and looked in the source code in:
https://github.com/liferay/com-liferay-document-library/blob/master/document-library-repository-cmis-impl/src/main/java/com/liferay/document/library/repository/cmis/internal/CMISAtomPubRepository.java
It looks like this:
String login = getLogin();
String password = null;
if (Validator.isNotNull(login)) {
password = PrincipalThreadLocal.getPassword();
}
else {
login = _DL_REPOSITORY_GUEST_USERNAME;
password = _DL_REPOSITORY_GUEST_PASSWORD;
}
parameters.put(SessionParameter.PASSWORD, password);
parameters.put(SessionParameter.USER, login);
And on the bottom of the page:
private static final String _DL_REPOSITORY_GUEST_PASSWORD =
GetterUtil.getString(
PropsUtil.get(PropsKeys.DL_REPOSITORY_GUEST_PASSWORD));
private static final String _DL_REPOSITORY_GUEST_USERNAME =
GetterUtil.getString(
PropsUtil.get(PropsKeys.DL_REPOSITORY_GUEST_USERNAME));
If I'm not misunderstanding, this means the portlet is using those two constant values I'm setting when the user isn't logged in, but it doesn't work.
Am I doing something wrong? Is there a different solution?
I am fairly new to liferay, and is working with the documents and media library in liferay 7 right now.
I registered a repository, and has already set up the portal properties to connect if the user is logged-in:
session.store.password=true
company.security.auth.type=screenName
This all work so far.
But here is the problem: I need guests to be able to connect as well, so I tried to hardcode a guest username and password in portal:
dl.repository.guest.username=guest
dl.repository.guest.password=guesttest
This doesn't seem to work.
I have already went and looked in the source code in:
https://github.com/liferay/com-liferay-document-library/blob/master/document-library-repository-cmis-impl/src/main/java/com/liferay/document/library/repository/cmis/internal/CMISAtomPubRepository.java
It looks like this:
String login = getLogin();
String password = null;
if (Validator.isNotNull(login)) {
password = PrincipalThreadLocal.getPassword();
}
else {
login = _DL_REPOSITORY_GUEST_USERNAME;
password = _DL_REPOSITORY_GUEST_PASSWORD;
}
parameters.put(SessionParameter.PASSWORD, password);
parameters.put(SessionParameter.USER, login);
And on the bottom of the page:
private static final String _DL_REPOSITORY_GUEST_PASSWORD =
GetterUtil.getString(
PropsUtil.get(PropsKeys.DL_REPOSITORY_GUEST_PASSWORD));
private static final String _DL_REPOSITORY_GUEST_USERNAME =
GetterUtil.getString(
PropsUtil.get(PropsKeys.DL_REPOSITORY_GUEST_USERNAME));
If I'm not misunderstanding, this means the portlet is using those two constant values I'm setting when the user isn't logged in, but it doesn't work.
Am I doing something wrong? Is there a different solution?