Skip to content

Commit eb60f59

Browse files
committed
Mendix v9.0.5 Project files - Excluded MendixSSO by default
1 parent d3f827d commit eb60f59

96 files changed

Lines changed: 2628 additions & 2629 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
# Administration module
22
The Administration module contains administration functionalities to manage local accounts and to see app statistics like runtime information, sessions and schedules events.
33

4-
## Instructions
5-
Steps to set-up when using Mendix SSO:
6-
- Make sure to either exclude or delete the microflows in the 'MOVE_THIS' folder in the MendixSSO module.
7-
- Configure the MendixSSO_AfterStartup microflow from this module (Marketplace modules > Administration > Mendix SSO) as the After startup microflow. If there is already an After startup microflow, you should not replace it, but add the MendixSSO_AfterStartup microflow as an action in the existing microflow.
8-
- If you previously used the Mendix SSO in your application, use the 'MendixSSO_MigrateUsersToAccount' microflow to migrate users from the MendixSSOUser to the Administration.Account specialization (if not, you do not need to run this migration microflow).
9-
10-
Steps to set-up without using Mendix SSO:
11-
- Delete or exclude the microflows in the 'Mendix SSO' folder (Marketplace modules > Administration > Mendix SSO) if you do not want to make use of Mendix SSO.
4+
## Mendix SSO
5+
If you want to use this module in combination with Mendix SSO, use the following steps:
6+
- Import the 'MendixSSO' module from the Marketplace (https://marketplace.mendix.com/link/component/111349)
7+
- Make sure to either exclude or delete the microflows in the 'MOVE_THIS' folder of the MendixSSO module.
8+
- Include the microflows prefixed with 'MendixSSO_' in the 'Mendix SSO' folder of the Administration module.
9+
- Configure the MendixSSO_AfterStartup microflow from the Administration module as the After startup microflow. If there is already an After startup microflow, do not replace it, but add the MendixSSO_AfterStartup microflow as a sub-microflow in the existing microflow.
10+
- If you previously used the Mendix SSO in your application, use the 'MendixSSO_MigrateUsersToAccount' microflow to migrate users from the MendixSSOUser to the Administration.Account specialization. Please read the instructions in the microflow carefully before executing the migration.
1211

1312
## License
1413
https://www.mendix.com/terms-of-use/
1514

1615
## Mendix marketplace
17-
https://marketplace.mendix.com/link/component/23513
16+
https://marketplace.mendix.com/link/component/23513

Source/AdministrationModule.mpr

0 Bytes
Binary file not shown.

Source/javasource/administration/proxies/Account.java

Whitespace-only changes.

Source/javasource/administration/proxies/AccountPasswordData.java

Whitespace-only changes.

Source/javasource/administration/proxies/microflows/Microflows.java

Whitespace-only changes.

Source/javasource/atlas_core/proxies/constants/Constants.java

Whitespace-only changes.
Lines changed: 131 additions & 131 deletions
Original file line numberDiff line numberDiff line change
@@ -1,131 +1,131 @@
1-
// This file was generated by Mendix Studio Pro.
2-
//
3-
// WARNING: Only the following code will be retained when actions are regenerated:
4-
// - the import list
5-
// - the code between BEGIN USER CODE and END USER CODE
6-
// - the code between BEGIN EXTRA CODE and END EXTRA CODE
7-
// Other code you write will be lost the next time you deploy the project.
8-
// Special characters, e.g., é, ö, à, etc. are supported in comments.
9-
10-
package mendixsso.actions;
11-
12-
import com.mendix.systemwideinterfaces.MendixRuntimeException;
13-
import com.mendix.systemwideinterfaces.core.IContext;
14-
import com.mendix.webui.CustomJavaAction;
15-
import javax.crypto.BadPaddingException;
16-
import javax.crypto.Cipher;
17-
import javax.crypto.spec.GCMParameterSpec;
18-
import javax.crypto.spec.IvParameterSpec;
19-
import javax.crypto.spec.SecretKeySpec;
20-
import java.security.InvalidAlgorithmParameterException;
21-
import java.util.Base64;
22-
23-
public class DecryptString extends CustomJavaAction<java.lang.String>
24-
{
25-
private java.lang.String value;
26-
private java.lang.String key;
27-
private java.lang.String prefix;
28-
29-
public DecryptString(IContext context, java.lang.String value, java.lang.String key, java.lang.String prefix)
30-
{
31-
super(context);
32-
this.value = value;
33-
this.key = key;
34-
this.prefix = prefix;
35-
}
36-
37-
@java.lang.Override
38-
public java.lang.String executeAction() throws Exception
39-
{
40-
// BEGIN USER CODE
41-
if (this.value == null || !isStartsWithRightPrefix())
42-
return null;
43-
if (this.prefix == null || this.prefix.isEmpty())
44-
throw new MendixRuntimeException("Prefix should not be empty");
45-
if (this.key == null || this.key.isEmpty())
46-
throw new MendixRuntimeException("Key should not be empty");
47-
if (this.key.length() != 16)
48-
throw new MendixRuntimeException("Key length should be 16");
49-
50-
String decryptedText = null;
51-
52-
if (isEncryptedWithLegacyAlgorithm(this.value)) {
53-
decryptedText = decryptUsingLegacyAlgorithm();
54-
} else {
55-
decryptedText = decryptUsingGcm();
56-
}
57-
58-
return decryptedText;
59-
// END USER CODE
60-
}
61-
62-
/**
63-
* Returns a string representation of this action
64-
*/
65-
@java.lang.Override
66-
public java.lang.String toString()
67-
{
68-
return "DecryptString";
69-
}
70-
71-
// BEGIN EXTRA CODE
72-
private final int GCM_TAG_LENGTH = 16; // in bytes
73-
private final String LEGACY_PREFIX = "{AES}";
74-
private final String WRONG_KEY_ERROR_MESSAGE = "Cannot decrypt the text because it was either NOT encrypted with a key of length 16 or they key is different";
75-
76-
private String decryptUsingGcm() throws Exception {
77-
String[] s = this.value.substring(this.prefix.length()).split(";");
78-
79-
if (s.length < 2) //Not an encrypted string, just return the original value.
80-
return this.value;
81-
82-
Cipher c = Cipher.getInstance("AES/GCM/PKCS5PADDING");
83-
SecretKeySpec k = new SecretKeySpec(this.key.getBytes(), "AES");
84-
85-
try {
86-
GCMParameterSpec spec = new GCMParameterSpec(GCM_TAG_LENGTH * 8, Base64.getDecoder().decode(s[0]));
87-
c.init(Cipher.DECRYPT_MODE, k, spec);
88-
byte[] encryptedData = Base64.getDecoder().decode(s[1]);
89-
return new String(c.doFinal(encryptedData));
90-
} catch (InvalidAlgorithmParameterException | BadPaddingException ex) {
91-
if (isEncryptedWithWrongKey(ex.getMessage()))
92-
throw new MendixRuntimeException(WRONG_KEY_ERROR_MESSAGE);
93-
else throw ex;
94-
}
95-
}
96-
97-
private boolean isEncryptedWithWrongKey(String message) {
98-
return
99-
message.equals("Wrong IV length: must be 16 bytes long") ||
100-
message.equals("Given final block not properly padded");
101-
}
102-
103-
private String decryptUsingLegacyAlgorithm() throws Exception {
104-
String[] s = this.value.substring(LEGACY_PREFIX.length()).split(";");
105-
106-
if (s.length < 2) //Not an encrypted string, just return the original value.
107-
return this.value;
108-
109-
Cipher c = Cipher.getInstance("AES/CBC/PKCS5PADDING");
110-
SecretKeySpec k = new SecretKeySpec(this.key.getBytes(), "AES");
111-
112-
try {
113-
c.init(Cipher.DECRYPT_MODE, k, new IvParameterSpec(Base64.getDecoder().decode(s[0])));
114-
byte[] encryptedData = Base64.getDecoder().decode(s[1]);
115-
return new String(c.doFinal(encryptedData));
116-
} catch (InvalidAlgorithmParameterException | BadPaddingException ex) {
117-
if (isEncryptedWithWrongKey(ex.getMessage()))
118-
throw new MendixRuntimeException(WRONG_KEY_ERROR_MESSAGE);
119-
else throw ex;
120-
}
121-
}
122-
123-
private boolean isEncryptedWithLegacyAlgorithm(String text) {
124-
return text.startsWith(LEGACY_PREFIX);
125-
}
126-
127-
private boolean isStartsWithRightPrefix() {
128-
return this.value.startsWith(this.value) || isEncryptedWithLegacyAlgorithm(this.value);
129-
}
130-
// END EXTRA CODE
131-
}
1+
// This file was generated by Mendix Studio Pro.
2+
//
3+
// WARNING: Only the following code will be retained when actions are regenerated:
4+
// - the import list
5+
// - the code between BEGIN USER CODE and END USER CODE
6+
// - the code between BEGIN EXTRA CODE and END EXTRA CODE
7+
// Other code you write will be lost the next time you deploy the project.
8+
// Special characters, e.g., é, ö, à, etc. are supported in comments.
9+
10+
package mendixsso.actions;
11+
12+
import com.mendix.systemwideinterfaces.MendixRuntimeException;
13+
import com.mendix.systemwideinterfaces.core.IContext;
14+
import com.mendix.webui.CustomJavaAction;
15+
import javax.crypto.BadPaddingException;
16+
import javax.crypto.Cipher;
17+
import javax.crypto.spec.GCMParameterSpec;
18+
import javax.crypto.spec.IvParameterSpec;
19+
import javax.crypto.spec.SecretKeySpec;
20+
import java.security.InvalidAlgorithmParameterException;
21+
import java.util.Base64;
22+
23+
public class DecryptString extends CustomJavaAction<java.lang.String>
24+
{
25+
private java.lang.String value;
26+
private java.lang.String key;
27+
private java.lang.String prefix;
28+
29+
public DecryptString(IContext context, java.lang.String value, java.lang.String key, java.lang.String prefix)
30+
{
31+
super(context);
32+
this.value = value;
33+
this.key = key;
34+
this.prefix = prefix;
35+
}
36+
37+
@java.lang.Override
38+
public java.lang.String executeAction() throws Exception
39+
{
40+
// BEGIN USER CODE
41+
if (this.value == null || !isStartsWithRightPrefix())
42+
return null;
43+
if (this.prefix == null || this.prefix.isEmpty())
44+
throw new MendixRuntimeException("Prefix should not be empty");
45+
if (this.key == null || this.key.isEmpty())
46+
throw new MendixRuntimeException("Key should not be empty");
47+
if (this.key.length() != 16)
48+
throw new MendixRuntimeException("Key length should be 16");
49+
50+
String decryptedText = null;
51+
52+
if (isEncryptedWithLegacyAlgorithm(this.value)) {
53+
decryptedText = decryptUsingLegacyAlgorithm();
54+
} else {
55+
decryptedText = decryptUsingGcm();
56+
}
57+
58+
return decryptedText;
59+
// END USER CODE
60+
}
61+
62+
/**
63+
* Returns a string representation of this action
64+
*/
65+
@java.lang.Override
66+
public java.lang.String toString()
67+
{
68+
return "DecryptString";
69+
}
70+
71+
// BEGIN EXTRA CODE
72+
private final int GCM_TAG_LENGTH = 16; // in bytes
73+
private final String LEGACY_PREFIX = "{AES}";
74+
private final String WRONG_KEY_ERROR_MESSAGE = "Cannot decrypt the text because it was either NOT encrypted with a key of length 16 or they key is different";
75+
76+
private String decryptUsingGcm() throws Exception {
77+
String[] s = this.value.substring(this.prefix.length()).split(";");
78+
79+
if (s.length < 2) //Not an encrypted string, just return the original value.
80+
return this.value;
81+
82+
Cipher c = Cipher.getInstance("AES/GCM/PKCS5PADDING");
83+
SecretKeySpec k = new SecretKeySpec(this.key.getBytes(), "AES");
84+
85+
try {
86+
GCMParameterSpec spec = new GCMParameterSpec(GCM_TAG_LENGTH * 8, Base64.getDecoder().decode(s[0]));
87+
c.init(Cipher.DECRYPT_MODE, k, spec);
88+
byte[] encryptedData = Base64.getDecoder().decode(s[1]);
89+
return new String(c.doFinal(encryptedData));
90+
} catch (InvalidAlgorithmParameterException | BadPaddingException ex) {
91+
if (isEncryptedWithWrongKey(ex.getMessage()))
92+
throw new MendixRuntimeException(WRONG_KEY_ERROR_MESSAGE);
93+
else throw ex;
94+
}
95+
}
96+
97+
private boolean isEncryptedWithWrongKey(String message) {
98+
return
99+
message.equals("Wrong IV length: must be 16 bytes long") ||
100+
message.equals("Given final block not properly padded");
101+
}
102+
103+
private String decryptUsingLegacyAlgorithm() throws Exception {
104+
String[] s = this.value.substring(LEGACY_PREFIX.length()).split(";");
105+
106+
if (s.length < 2) //Not an encrypted string, just return the original value.
107+
return this.value;
108+
109+
Cipher c = Cipher.getInstance("AES/CBC/PKCS5PADDING");
110+
SecretKeySpec k = new SecretKeySpec(this.key.getBytes(), "AES");
111+
112+
try {
113+
c.init(Cipher.DECRYPT_MODE, k, new IvParameterSpec(Base64.getDecoder().decode(s[0])));
114+
byte[] encryptedData = Base64.getDecoder().decode(s[1]);
115+
return new String(c.doFinal(encryptedData));
116+
} catch (InvalidAlgorithmParameterException | BadPaddingException ex) {
117+
if (isEncryptedWithWrongKey(ex.getMessage()))
118+
throw new MendixRuntimeException(WRONG_KEY_ERROR_MESSAGE);
119+
else throw ex;
120+
}
121+
}
122+
123+
private boolean isEncryptedWithLegacyAlgorithm(String text) {
124+
return text.startsWith(LEGACY_PREFIX);
125+
}
126+
127+
private boolean isStartsWithRightPrefix() {
128+
return this.value.startsWith(this.value) || isEncryptedWithLegacyAlgorithm(this.value);
129+
}
130+
// END EXTRA CODE
131+
}

0 commit comments

Comments
 (0)