Search in sources :

Example 1 with ApplicationContext

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;
}
Also used : Array(lucee.runtime.type.Array) ApplicationContext(lucee.runtime.listener.ApplicationContext) Credential(lucee.runtime.security.Credential) IOException(java.io.IOException)

Example 2 with ApplicationContext

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;
}
Also used : ApplicationContext(lucee.runtime.listener.ApplicationContext) ExpressionException(lucee.runtime.exp.ExpressionException)

Example 3 with ApplicationContext

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();
}
Also used : ApplicationContext(lucee.runtime.listener.ApplicationContext)

Example 4 with ApplicationContext

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);
}
Also used : ApplicationContext(lucee.runtime.listener.ApplicationContext) StorageScope(lucee.runtime.type.scope.storage.StorageScope) MemoryScope(lucee.runtime.type.scope.storage.MemoryScope)

Example 5 with ApplicationContext

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);
}
Also used : ApplicationContext(lucee.runtime.listener.ApplicationContext) StorageScope(lucee.runtime.type.scope.storage.StorageScope) MemoryScope(lucee.runtime.type.scope.storage.MemoryScope)

Aggregations

ApplicationContext (lucee.runtime.listener.ApplicationContext)28 MemoryScope (lucee.runtime.type.scope.storage.MemoryScope)10 StorageScope (lucee.runtime.type.scope.storage.StorageScope)10 HttpSession (javax.servlet.http.HttpSession)6 DataSource (lucee.runtime.db.DataSource)4 ApplicationContextSupport (lucee.runtime.listener.ApplicationContextSupport)4 Key (lucee.runtime.type.Collection.Key)4 CacheConnection (lucee.runtime.cache.CacheConnection)3 ExpressionException (lucee.runtime.exp.ExpressionException)3 PageException (lucee.runtime.exp.PageException)3 TimeSpan (lucee.runtime.type.dt.TimeSpan)3 IKHandlerCache (lucee.runtime.type.scope.storage.IKHandlerCache)3 IKHandlerDatasource (lucee.runtime.type.scope.storage.IKHandlerDatasource)3 IOException (java.io.IOException)2 Map (java.util.Map)2 Resource (lucee.commons.io.res.Resource)2 RefBooleanImpl (lucee.commons.lang.types.RefBooleanImpl)2 ApplicationException (lucee.runtime.exp.ApplicationException)2 ClassicApplicationContext (lucee.runtime.listener.ClassicApplicationContext)2 ModernApplicationContext (lucee.runtime.listener.ModernApplicationContext)2