use of lucee.runtime.listener.ApplicationContext in project Lucee by lucee.
the class Login method doStartTag.
@Override
public int doStartTag() throws PageException {
ApplicationContext ac = pageContext.getApplicationContext();
ac.setSecuritySettings(applicationtoken, cookiedomain, idletimeout);
Credential remoteUser = pageContext.getRemoteUser();
if (remoteUser == null) {
// Form
Object name = pageContext.formScope().get("j_username", null);
Object password = pageContext.formScope().get("j_password", null);
if (name != null) {
setCFLogin(name, password);
return EVAL_BODY_INCLUDE;
}
// Header
String strAuth = pageContext.getHttpServletRequest().getHeader("authorization");
if (strAuth != null) {
int pos = strAuth.indexOf(' ');
if (pos != -1) {
String format = strAuth.substring(0, pos).toLowerCase();
if (format.equals("basic")) {
String encoded = strAuth.substring(pos + 1);
String dec;
try {
dec = Base64Coder.decodeToString(encoded, "UTF-8");
} catch (IOException e) {
throw Caster.toPageException(e);
}
// print.ln("encoded:"+encoded);
// print.ln("decoded:"+Base64Util.decodeBase64(encoded));
Array arr = ListUtil.listToArray(dec, ":");
if (arr.size() < 3) {
if (arr.size() == 1)
setCFLogin(arr.get(1, null), "");
else
setCFLogin(arr.get(1, null), arr.get(2, null));
}
}
}
}
return EVAL_BODY_INCLUDE;
}
return SKIP_BODY;
}
use of lucee.runtime.listener.ApplicationContext in project Lucee by lucee.
the class UDFSetterProperty method call.
@Override
public Object call(PageContext pageContext, Object[] args, boolean doIncludePath) throws PageException {
if (args.length < 1)
throw new ExpressionException("The parameter " + prop.getName() + " to function " + getFunctionName() + " is required but was not passed in.");
validate(validate, validateParams, args[0]);
component.getComponentScope().set(propName, cast(pageContext, this.arguments[0], args[0], 1));
// make sure it is reconized that set is called by hibernate
// if(component.isPersistent())ORMUtil.getSession(pageContext);
ApplicationContext appContext = pageContext.getApplicationContext();
if (appContext.isORMEnabled() && component.isPersistent())
ORMUtil.getSession(pageContext);
return component;
}
use of lucee.runtime.listener.ApplicationContext in project Lucee by lucee.
the class ApplicationImpl method touchBeforeRequest.
@Override
public void touchBeforeRequest(PageContext pc) {
ApplicationContext appContext = pc.getApplicationContext();
setEL(APPLICATION_NAME, appContext.getName());
timeSpan = appContext.getApplicationTimeout().getMillis();
lastAccess = System.currentTimeMillis();
}
use of lucee.runtime.listener.ApplicationContext in project Lucee by lucee.
the class ScopeContext method hasExistingCFSessionScope.
private boolean hasExistingCFSessionScope(PageContext pc, String cfid) {
ApplicationContext appContext = pc.getApplicationContext();
Map<String, Scope> context = getSubMap(cfSessionContexts, appContext.getName());
return context.containsKey(cfid);
}
use of lucee.runtime.listener.ApplicationContext in project Lucee by lucee.
the class ScopeContext method getAppContextSessionCount.
/**
* return the session count of this application context
*
* @return
*/
public int getAppContextSessionCount(PageContext pc) {
ApplicationContext appContext = pc.getApplicationContext();
if (pc.getSessionType() == Config.SESSION_TYPE_JEE)
return 0;
Map<String, Scope> context = getSubMap(cfSessionContexts, appContext.getName());
return getCount(context);
}
Aggregations