java.lang.Object
io.helidon.security.Subject.Builder
- All Implemented Interfaces:
Builder<Subject.Builder,
,Subject> Supplier<Subject>
- Enclosing class:
- Subject
public static final class Subject.Builder
extends Object
implements Builder<Subject.Builder,Subject>
A fluent API builder for
Subject
.-
Method Summary
Modifier and TypeMethodDescriptionaddAttribute
(String key, Object value) Add an attribute to this subject.Add a grant to this subject.addPrincipal
(Principal principal) Add a principal to the list of principals of this subject.addPrivateCredential
(Class<?> className, Object instance) Add a private credential to this subject.addPrivateCredential
(Object instance) Add a private credential to this subject to be bound under its class.addPublicCredential
(Class<?> className, Object instance) Add a public credential to this subject.addPublicCredential
(Object instance) Add a public credential to this subject to be bound under its class.attributes
(AbacSupport attributes) Add all attributes to this subject.build()
Build the instance from this builder.Main principal of this subject.Update this builder with all security information from the subject provided.
-
Method Details
-
build
Description copied from interface:Builder
Build the instance from this builder.- Specified by:
build
in interfaceBuilder<Subject.Builder,
Subject> - Returns:
- instance of the built type
-
update
Update this builder with all security information from the subject provided.- Parameters:
subject
- subject to copy information from- Returns:
- updated builder instance
-
principal
Main principal of this subject.- Parameters:
principal
- principal (e.g. a user or a service)- Returns:
- updated builder instance
-
addGrant
Add a grant to this subject.- Parameters:
grant
- grant to add (e.g. a role, scope, permission etc.)- Returns:
- updated builder instance
-
addPublicCredential
Add a public credential to this subject. Only one instance of a type may be added to a subject.- Parameters:
className
- class of the credential (e.g. X509 certificate)instance
- instance of the credential- Returns:
- updated builder instance
-
addPublicCredential
Add a public credential to this subject to be bound under its class.- Parameters:
instance
- instance of the credential, the class it will be bound to is obtained throughinstance.getClass()
- Returns:
- updated builder instance
-
addPrivateCredential
Add a private credential to this subject. Only one instance of a type may be added to a subject.- Parameters:
className
- class of the credential (e.g. X509 certificate)instance
- instance of the credential- Returns:
- updated builder instance
-
addPrivateCredential
Add a private credential to this subject to be bound under its class.- Parameters:
instance
- instance of the credential, the class it will be bound to is obtained throughinstance.getClass()
- Returns:
- updated builder instance
-
attributes
Add all attributes to this subject. Attributes can extend information with data not fitting to other fields of this subject.- Parameters:
attributes
- attributes with key/value pairs- Returns:
- updated builder instance
-
addAttribute
Add an attribute to this subject.- Parameters:
key
- name of the attributevalue
- value of the attribute- Returns:
- updated builder instance
-
addPrincipal
Add a principal to the list of principals of this subject. Ifprincipal(Principal)
was not invoked prior to this method, it will also set the "main" principal.- Parameters:
principal
- principal to add to this subject- Returns:
- updated builder instance
-