* under the License.
*/
+import org.apache.archiva.admin.model.beans.RedbackRuntimeConfiguration;
+import org.apache.archiva.redback.configuration.UserConfigurationKeys;
import org.apache.archiva.rest.api.services.ArchivaRestServiceException;
import org.apache.archiva.rest.api.services.RedbackRuntimeConfigurationService;
+import org.apache.archiva.web.model.CookieInformation;
import org.apache.archiva.web.runtime.ArchivaRuntimeInfo;
import org.apache.archiva.web.model.ApplicationRuntimeInfo;
+import org.apache.commons.lang.BooleanUtils;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
new Locale( StringUtils.isEmpty( locale ) ? "en" : locale ) );
applicationRuntimeInfo.setTimestampStr( sfd.format( new Date( archivaRuntimeInfo.getTimestamp() ) ) );
- applicationRuntimeInfo.setRedbackRuntimeConfiguration(
- redbackRuntimeConfigurationService.getRedbackRuntimeConfiguration() );
+ CookieInformation cookieInformation = new CookieInformation();
+
+ RedbackRuntimeConfiguration redbackRuntimeConfiguration =
+ redbackRuntimeConfigurationService.getRedbackRuntimeConfiguration();
+
+ cookieInformation.setDomain(
+ redbackRuntimeConfiguration.getConfigurationProperties().get( UserConfigurationKeys.REMEMBER_ME_DOMAIN ) );
+ cookieInformation.setPath(
+ redbackRuntimeConfiguration.getConfigurationProperties().get( UserConfigurationKeys.REMEMBER_ME_PATH ) );
+ cookieInformation.setSecure(
+ redbackRuntimeConfiguration.getConfigurationProperties().get( UserConfigurationKeys.REMEMBER_ME_SECURE ) );
+ cookieInformation.setTimeout(
+ redbackRuntimeConfiguration.getConfigurationProperties().get( UserConfigurationKeys.REMEMBER_ME_TIMEOUT ) );
+ cookieInformation.setRememberMeEnabled( BooleanUtils.toBoolean(
+ redbackRuntimeConfiguration.getConfigurationProperties().get(
+ UserConfigurationKeys.REMEMBER_ME_ENABLED ) ) );
+
+ applicationRuntimeInfo.setCookieInformation( cookieInformation );
return applicationRuntimeInfo;
}
import org.apache.archiva.admin.model.beans.RedbackRuntimeConfiguration;
import javax.xml.bind.annotation.XmlRootElement;
+import java.io.Serializable;
import java.util.Calendar;
/**
*/
@XmlRootElement(name = "applicationRuntimeInfo")
public class ApplicationRuntimeInfo
+ implements Serializable
{
private boolean devMode = false;
private String timestampStr;
- private RedbackRuntimeConfiguration redbackRuntimeConfiguration;
+ private CookieInformation cookieInformation;
public ApplicationRuntimeInfo()
{
this.timestampStr = timestampStr;
}
- public RedbackRuntimeConfiguration getRedbackRuntimeConfiguration()
+ public CookieInformation getCookieInformation()
{
- return redbackRuntimeConfiguration;
+ return cookieInformation;
}
- public void setRedbackRuntimeConfiguration( RedbackRuntimeConfiguration redbackRuntimeConfiguration )
+ public void setCookieInformation( CookieInformation cookieInformation )
{
- this.redbackRuntimeConfiguration = redbackRuntimeConfiguration;
+ this.cookieInformation = cookieInformation;
}
@Override
sb.append( ", logMissingI18n=" ).append( logMissingI18n );
sb.append( ", baseUrl='" ).append( baseUrl ).append( '\'' );
sb.append( ", timestampStr='" ).append( timestampStr ).append( '\'' );
- sb.append( ", redbackRuntimeConfiguration=" ).append( redbackRuntimeConfiguration );
+ sb.append( ", cookieInformation=" ).append( cookieInformation );
sb.append( '}' );
return sb.toString();
}
window.archivaJavascriptLog=data.javascriptLog;
window.archivaRuntimeInfo=data;
- window.redbackRuntimeConfiguration=mapRedbackRuntimeConfiguration(data.redbackRuntimeConfiguration);
-
- $.log("security.rememberme.enabled key value:"+ window.redbackRuntimeConfiguration.findPropertyValue('security.rememberme.enabled'));
+ window.cookieInformation=mapCookieInformation(data.cookieInformation);
require(['sammy','jquery','i18n','jquery.tmpl','archiva.main','utils','domReady!'],function () {
startArchivaApplication();
type: "GET",
dataType: 'json',
success: function(data) {
- // TODO use window.redbackRuntimeConfiguration ?
var redbackRuntimeConfiguration = mapRedbackRuntimeConfiguration(data);
var redbackRuntimeConfigurationViewModel =
new RedbackRuntimeConfigurationViewModel(redbackRuntimeConfiguration,userManagerImplementationInformations);
return new CacheConfiguration(data.timeToIdleSeconds,data.timeToLiveSeconds,data.maxElementsInMemory,data.maxElementsOnDisk);
}
+ CookieInformation=function(path,domain,secure,timeout,rememberMeEnabled){
+ //private String path;
+ this.path=path;
+
+ //private String domain;
+ this.domain=domain;
+
+ //private String secure;
+ this.secure=secure;
+
+ //private String timeout;
+ this.timeout=timeout;
+
+ //private boolean rememberMeEnabled;
+ this.rememberMeEnabled=rememberMeEnabled;
+ }
+
+ mapCookieInformation=function(data){
+ if(!data){
+ return new CookieInformation();
+ }
+ return new CookieInformation(data.path,data.domain,data.secure,data.timeout,data.rememberMeEnabled);
+ }
+
});
\ No newline at end of file
*/
reccordLoginCookie=function(user) {
- var path = window.redbackRuntimeConfiguration.findPropertyValue("security.rememberme.path");
+ var path = window.cookieInformation.path;
path = path ? path : "/";
- var domain = window.redbackRuntimeConfiguration.findPropertyValue("security.rememberme.domain");
- var secure = window.redbackRuntimeConfiguration.findPropertyValue("security.rememberme.secure");
+ var domain = window.cookieInformation.domain;
+ var secure = window.cookieInformation.secure;
- var expires= Number(window.redbackRuntimeConfiguration.findPropertyValue("security.rememberme.timeout"));
+ var expires= Number(window.cookieInformation.timeout);
var userJson=ko.toJSON(user);
$.log("user not in cookie");
}
- var rememberMe=window.redbackRuntimeConfiguration.findPropertyValue('security.rememberme.enabled');
+ var rememberMe=window.cookieInformation.rememberMeEnabled;
$.log("rememberMe:"+rememberMe);
- if (rememberMe=='false'){
+ if (rememberMe=='true'){
$("#user-login-form-rememberme-label" ).hide();
$("#user-login-form-rememberme" ).attr("disabled","true");
if($("#user-login-form-rememberme" ).get(0 ).checked){