Package org.keycloak.util
Interface AuthorizationDetailsParser
- All Known Implementing Classes:
OID4VCAuthorizationDetailsProcessor.OID4VCAuthorizationDetailsParser
public interface AuthorizationDetailsParser
Parser, which is able to create specific subtype of
AuthorizationDetailsJSONRepresentation in performant way-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescription<T extends AuthorizationDetailsJSONRepresentation>
TasSubtype(AuthorizationDetailsJSONRepresentation authzDetail, Class<T> clazz) static <T extends AuthorizationDetailsJSONRepresentation>
TparseToSubtype(AuthorizationDetailsJSONRepresentation authzDetail, Class<T> clazz) Method is not supposed to be called directly.static voidregisterParser(String type, AuthorizationDetailsParser parser) Register new parser for specific type.
-
Field Details
-
PARSERS
-
-
Method Details
-
asSubtype
<T extends AuthorizationDetailsJSONRepresentation> T asSubtype(AuthorizationDetailsJSONRepresentation authzDetail, Class<T> clazz) -
registerParser
Register new parser for specific type. This can be later used byasSubtype(org.keycloak.representations.AuthorizationDetailsJSONRepresentation, java.lang.Class<T>)method. Parsers are supposed to be registered before authorizationDetails are being used by the application and before methodasSubtype(org.keycloak.representations.AuthorizationDetailsJSONRepresentation, java.lang.Class<T>)is called for the first time. Usually it is supposed to be registered at the startup of the application. If implementing Keycloak provider AuthorizationDetailsProcessor, it might be good to register corresponding parser in the AuthorizationDetailsProcessorFactory.init method of your provider- Parameters:
type- Type as used in the "type" claim of "authorization_details" object entryparser- Parser for this type
-
parseToSubtype
static <T extends AuthorizationDetailsJSONRepresentation> T parseToSubtype(AuthorizationDetailsJSONRepresentation authzDetail, Class<T> clazz) Method is not supposed to be called directly. Rather please make sure to useregisterParser(String, AuthorizationDetailsParser)and then useasSubtype(AuthorizationDetailsJSONRepresentation, Class)to call directly from the application- Parameters:
authzDetail- Authorization detail object to castclazz- Subtype ofAuthorizationDetailsJSONRepresentation, which will be returned by calling this method- Returns:
- given authzDetail passed in authzDetail parameter cast to the class specified by clazz parameter as long as parser corresponding to the type
returned by
AuthorizationDetailsJSONRepresentation.getType()is able to parse this authorizationDetails and convert it to that subtype
-