-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from ortus-boxlang/development
beta 20 compat
- Loading branch information
Showing
6 changed files
with
79 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#Thu Oct 10 20:35:15 UTC 2024 | ||
#Tue Oct 15 15:37:17 UTC 2024 | ||
boxlangVersion=1.0.0-snapshot | ||
jdkVersion=21 | ||
version=1.9.0 | ||
version=1.10.0 | ||
group=ortus.boxlang |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
src/main/java/ortus/boxlang/modules/compat/interceptors/SessionListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/** | ||
* [BoxLang] | ||
* | ||
* Copyright [2023] [Ortus Solutions, Corp] | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the | ||
* License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" | ||
* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language | ||
* governing permissions and limitations under the License. | ||
*/ | ||
package ortus.boxlang.modules.compat.interceptors; | ||
|
||
import ortus.boxlang.runtime.application.Session; | ||
import ortus.boxlang.runtime.events.BaseInterceptor; | ||
import ortus.boxlang.runtime.events.InterceptionPoint; | ||
import ortus.boxlang.runtime.scopes.Key; | ||
import ortus.boxlang.runtime.scopes.SessionScope; | ||
import ortus.boxlang.runtime.types.IStruct; | ||
|
||
/** | ||
* Listens to when sessions get created to manipulate them for CFML compatibility | ||
*/ | ||
public class SessionListener extends BaseInterceptor { | ||
|
||
/** | ||
* The URL token format | ||
* MOVE TO COMPAT MODULE | ||
*/ | ||
public static final String URL_TOKEN_FORMAT = "CFID=%s"; | ||
|
||
/** | ||
* Intercept BIF Invocation | ||
* | ||
* @param interceptData The struct containing the context and arguments of the BIF Invocation | ||
*/ | ||
@InterceptionPoint | ||
public void onSessionCreated( IStruct interceptData ) { | ||
// Get the session from the interceptData | ||
Session userSession = ( Session ) interceptData.get( Key.session ); | ||
SessionScope sessionScope = userSession.getSessionScope(); | ||
Key sessionID = userSession.getID(); | ||
|
||
// This is 0 for compatibility with CFML and for security. | ||
sessionScope.put( Key.cftoken, 0 ); | ||
// This is the session ID for compatibility with CFML | ||
sessionScope.put( Key.cfid, sessionID.getName() ); | ||
|
||
// URL Token Compat | ||
String bxid = userSession.getApplicationName() + Session.ID_CONCATENATOR + sessionID; | ||
sessionScope.put( Key.urlToken, String.format( URL_TOKEN_FORMAT, bxid ) ); | ||
} | ||
|
||
} |