Package org.keycloak.validate
Class ValidationContext
java.lang.Object
org.keycloak.validate.ValidationContext
- Direct Known Subclasses:
UserProfileAttributeValidationContext
Holds information about the validation state.
-
Constructor Summary
ModifierConstructorDescriptionCreates a newValidationContext
without aKeycloakSession
.ValidationContext
(KeycloakSession session) Creates a newValidationContext
with aKeycloakSession
.protected
ValidationContext
(KeycloakSession session, Set<ValidationError> errors) Creates a newValidationContext
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addError
(ValidationError error) Adds anValidationError
.boolean
isValid()
Convenience method for checking the validation status of the currentValidationContext
.toResult()
Creates aValidationResult
based on the current errors;toString()
Eases access toValidator's
for nested validation.
-
Constructor Details
-
ValidationContext
public ValidationContext()Creates a newValidationContext
without aKeycloakSession
. -
ValidationContext
Creates a newValidationContext
with aKeycloakSession
.- Parameters:
session
-
-
ValidationContext
Creates a newValidationContext
.- Parameters:
session
-errors
-
-
-
Method Details
-
validator
Eases access toValidator's
for nested validation.- Parameters:
validatorId
-- Returns:
-
addError
Adds anValidationError
.- Parameters:
error
-
-
isValid
public boolean isValid()Convenience method for checking the validation status of the currentValidationContext
.This is an alternative to
toResult().isValid()
for brief validations.- Returns:
-
getAttributes
-
getSession
-
getErrors
-
toResult
Creates aValidationResult
based on the current errors;- Returns:
-
toString
-