Class RequireAnyAttributeAuthorizer<U extends UserProfile>
- java.lang.Object
-
- org.pac4j.core.authorization.authorizer.ProfileAuthorizer<U>
-
- org.pac4j.core.authorization.authorizer.AbstractRequireElementAuthorizer<E,U>
-
- org.pac4j.core.authorization.authorizer.AbstractRequireAnyAuthorizer<String,U>
-
- org.pac4j.core.authorization.authorizer.RequireAnyAttributeAuthorizer<U>
-
- All Implemented Interfaces:
Authorizer<U>
public class RequireAnyAttributeAuthorizer<U extends UserProfile> extends AbstractRequireAnyAuthorizer<String,U>
This isRequireAnyAttributeAuthorizer
which checks profile attributes for the specified element, and optionally may pattern-check the configured value. In practice, you may use this authorizer to see if the profile contains attribute X and optionally, whether X has a value that matches pattern Y.- Since:
- 1.9.2
- Author:
- Misagh Moayyed
-
-
Field Summary
-
Fields inherited from class org.pac4j.core.authorization.authorizer.AbstractRequireElementAuthorizer
elements
-
-
Constructor Summary
Constructors Constructor Description RequireAnyAttributeAuthorizer()
RequireAnyAttributeAuthorizer(String valueToMatch)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
check(WebContext context, U profile, String element)
Check a specific element.static <U extends UserProfile>
RequireAnyAttributeAuthorizer<U>requireAnyAttribute(String valueToMatch)
-
Methods inherited from class org.pac4j.core.authorization.authorizer.AbstractRequireAnyAuthorizer
isProfileAuthorized
-
Methods inherited from class org.pac4j.core.authorization.authorizer.AbstractRequireElementAuthorizer
getElements, isAuthorized, setElements, setElements, setElements
-
Methods inherited from class org.pac4j.core.authorization.authorizer.ProfileAuthorizer
handleError, isAllAuthorized, isAnyAuthorized
-
-
-
-
Constructor Detail
-
RequireAnyAttributeAuthorizer
public RequireAnyAttributeAuthorizer()
-
RequireAnyAttributeAuthorizer
public RequireAnyAttributeAuthorizer(String valueToMatch)
-
-
Method Detail
-
check
protected boolean check(WebContext context, U profile, String element)
Description copied from class:AbstractRequireElementAuthorizer
Check a specific element.- Specified by:
check
in classAbstractRequireElementAuthorizer<String,U extends UserProfile>
- Parameters:
context
- the web contextprofile
- the profileelement
- the element to check- Returns:
- whether it is authorized for this element
-
requireAnyAttribute
public static <U extends UserProfile> RequireAnyAttributeAuthorizer<U> requireAnyAttribute(String valueToMatch)
-
-