@@ -14,9 +14,14 @@ public class AuthnRequestParams {
1414 */
1515 private final boolean isPassive ;
1616 /**
17- * When true the AuthNReuqest will set a nameIdPolicy
17+ * When true the AuthNRequest will set a nameIdPolicy
1818 */
1919 private final boolean setNameIdPolicy ;
20+ /**
21+ * When true and {@link #setNameIdPolicy} is also <code>true</code>, then the
22+ * AllowCreate='true' will be set on the NameIDPolicy element
23+ */
24+ private final boolean allowCreate ;
2025 /**
2126 * Indicates to the IdP the subject that should be authenticated
2227 */
@@ -29,13 +34,34 @@ public class AuthnRequestParams {
2934 * whether the <code>ForceAuthn</code> attribute should be set to
3035 * <code>true</code>
3136 * @param isPassive
32- * whether the <code>isPassive </code> attribute should be set to
37+ * whether the <code>IsPassive </code> attribute should be set to
3338 * <code>true</code>
3439 * @param setNameIdPolicy
3540 * whether a <code>NameIDPolicy</code> should be set
3641 */
3742 public AuthnRequestParams (boolean forceAuthn , boolean isPassive , boolean setNameIdPolicy ) {
38- this (forceAuthn , isPassive , setNameIdPolicy , null );
43+ this (forceAuthn , isPassive , setNameIdPolicy , true );
44+ }
45+
46+ /**
47+ * Create a set of authentication request input parameters.
48+ *
49+ * @param forceAuthn
50+ * whether the <code>ForceAuthn</code> attribute should be set to
51+ * <code>true</code>
52+ * @param isPassive
53+ * whether the <code>IsPassive</code> attribute should be set to
54+ * <code>true</code>
55+ * @param setNameIdPolicy
56+ * whether a <code>NameIDPolicy</code> should be set
57+ * @param allowCreate
58+ * whether the <code>AllowCreate</code> attribute should be set to
59+ * <code>true</code> on the <code>NameIDPolicy</code> element; only
60+ * meaningful if <code>setNameIdPolicy</code> is also
61+ * <code>true</code>
62+ */
63+ public AuthnRequestParams (boolean forceAuthn , boolean isPassive , boolean setNameIdPolicy , boolean allowCreate ) {
64+ this (forceAuthn , isPassive , setNameIdPolicy , allowCreate , null );
3965 }
4066
4167 /**
@@ -45,17 +71,42 @@ public AuthnRequestParams(boolean forceAuthn, boolean isPassive, boolean setName
4571 * whether the <code>ForceAuthn</code> attribute should be set to
4672 * <code>true</code>
4773 * @param isPassive
48- * whether the <code>isPassive </code> attribute should be set to
74+ * whether the <code>IsPassive </code> attribute should be set to
4975 * <code>true</code>
5076 * @param setNameIdPolicy
5177 * whether a <code>NameIDPolicy</code> should be set
5278 * @param nameIdValueReq
5379 * the subject that should be authenticated
5480 */
5581 public AuthnRequestParams (boolean forceAuthn , boolean isPassive , boolean setNameIdPolicy , String nameIdValueReq ) {
82+ this (forceAuthn , isPassive , setNameIdPolicy , true , nameIdValueReq );
83+ }
84+
85+ /**
86+ * Create a set of authentication request input parameters.
87+ *
88+ * @param forceAuthn
89+ * whether the <code>ForceAuthn</code> attribute should be set to
90+ * <code>true</code>
91+ * @param isPassive
92+ * whether the <code>IsPassive</code> attribute should be set to
93+ * <code>true</code>
94+ * @param setNameIdPolicy
95+ * whether a <code>NameIDPolicy</code> should be set
96+ * @param allowCreate
97+ * the value to set for the <code>allowCreate</code> attribute of
98+ * <code>NameIDPolicy</code> element; <code>null</code> means it's
99+ * not set at all; only meaningful when
100+ * <code>setNameIdPolicy</code> is <code>true</code>
101+ * @param nameIdValueReq
102+ * the subject that should be authenticated
103+ */
104+ public AuthnRequestParams (boolean forceAuthn , boolean isPassive , boolean setNameIdPolicy , boolean allowCreate ,
105+ String nameIdValueReq ) {
56106 this .forceAuthn = forceAuthn ;
57107 this .isPassive = isPassive ;
58108 this .setNameIdPolicy = setNameIdPolicy ;
109+ this .allowCreate = allowCreate ;
59110 this .nameIdValueReq = nameIdValueReq ;
60111 }
61112
@@ -70,32 +121,42 @@ protected AuthnRequestParams(AuthnRequestParams source) {
70121 this .forceAuthn = source .isForceAuthn ();
71122 this .isPassive = source .isPassive ();
72123 this .setNameIdPolicy = source .isSetNameIdPolicy ();
124+ this .allowCreate = source .isAllowCreate ();
73125 this .nameIdValueReq = source .getNameIdValueReq ();
74126 }
75127
76128 /**
77129 * @return whether the <code>ForceAuthn</code> attribute should be set to
78130 * <code>true</code>
79131 */
80- protected boolean isForceAuthn () {
132+ public boolean isForceAuthn () {
81133 return forceAuthn ;
82134 }
83135
84136 /**
85- * @return whether the <code>isPassive </code> attribute should be set to
137+ * @return whether the <code>IsPassive </code> attribute should be set to
86138 * <code>true</code>
87139 */
88- protected boolean isPassive () {
140+ public boolean isPassive () {
89141 return isPassive ;
90142 }
91143
92144 /**
93145 * @return whether a <code>NameIDPolicy</code> should be set
94146 */
95- protected boolean isSetNameIdPolicy () {
147+ public boolean isSetNameIdPolicy () {
96148 return setNameIdPolicy ;
97149 }
98150
151+ /**
152+ * @return whether the <code>AllowCreate</code> attribute should be set to
153+ * <code>true</code> on the <code>NameIDPolicy</code> element (only
154+ * meaningful if {@link #isSetNameIdPolicy()} is also <code>true</code>)
155+ */
156+ public boolean isAllowCreate () {
157+ return allowCreate ;
158+ }
159+
99160 /**
100161 * @return the subject that should be authenticated
101162 */
0 commit comments