| 233 | } |
| 234 | |
| 235 | func TestSAMLConfigurationValidateNextKey(t *testing.T) { |
| 236 | invalidExamples := []*SAMLConfiguration{ |
| 237 | { |
| 238 | Enabled: true, |
| 239 | PrivateKey: validPrivateKey, |
| 240 | PrivateKeyNext: "InvalidBase64!", |
| 241 | }, |
| 242 | { |
| 243 | Enabled: true, |
| 244 | PrivateKey: validPrivateKey, |
| 245 | PrivateKeyNext: base64.StdEncoding.EncodeToString([]byte("not PKCS#1")), |
| 246 | }, |
| 247 | { |
| 248 | Enabled: true, |
| 249 | PrivateKey: validPrivateKey, |
| 250 | PrivateKeyNext: invalidRSA1024Key, |
| 251 | }, |
| 252 | { |
| 253 | Enabled: true, |
| 254 | PrivateKey: validPrivateKey, |
| 255 | PrivateKeyNext: invalidWrongExponentKey, |
| 256 | }, |
| 257 | } |
| 258 | |
| 259 | for i, example := range invalidExamples { |
| 260 | err := example.Validate() |
| 261 | require.Error(t, err, "Invalid next key example %d was regarded as valid", i) |
| 262 | } |
| 263 | } |
| 264 | |
| 265 | func TestSAMLConfigurationDeterministicCertificate(t *testing.T) { |
| 266 | a := &SAMLConfiguration{ |