Package io.helidon.security
Class Subject.Builder
- java.lang.Object
-
- io.helidon.security.Subject.Builder
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Subject.BuilderaddAttribute(String key, Object value)Add an attribute to this subject.Subject.BuilderaddGrant(Grant grant)Add a grant to this subject.Subject.BuilderaddPrincipal(Principal principal)Add a principal to the list of principals of this subject.Subject.BuilderaddPrivateCredential(Class<?> className, Object instance)Add a private credential to this subject.Subject.BuilderaddPrivateCredential(Object instance)Add a private credential to this subject to be bound under its class.Subject.BuilderaddPublicCredential(Class<?> className, Object instance)Add a public credential to this subject.Subject.BuilderaddPublicCredential(Object instance)Add a public credential to this subject to be bound under its class.Subject.Builderattributes(AbacSupport attributes)Add all attributes to this subject.Subjectbuild()Build the instance from this builder.Subject.Builderprincipal(Principal principal)Main principal of this subject.Subject.Builderupdate(Subject subject)Update this builder with all security information from the subject provided.
-
-
-
Method Detail
-
build
public Subject build()
Description copied from interface:BuilderBuild the instance from this builder.
-
update
public Subject.Builder update(Subject subject)
Update this builder with all security information from the subject provided.- Parameters:
subject- subject to copy information from- Returns:
- updated builder instance
-
principal
public Subject.Builder principal(Principal principal)
Main principal of this subject.- Parameters:
principal- principal (e.g. a user or a service)- Returns:
- updated builder instance
-
addGrant
public Subject.Builder addGrant(Grant grant)
Add a grant to this subject.- Parameters:
grant- grant to add (e.g. a role, scope, permission etc.)- Returns:
- updated builder instance
-
addPublicCredential
public Subject.Builder addPublicCredential(Class<?> className, Object instance)
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
public Subject.Builder addPublicCredential(Object instance)
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
public Subject.Builder addPrivateCredential(Class<?> className, Object instance)
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
public Subject.Builder addPrivateCredential(Object instance)
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
public Subject.Builder attributes(AbacSupport 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
public Subject.Builder addAttribute(String key, Object value)
Add an attribute to this subject.- Parameters:
key- name of the attributevalue- value of the attribute- Returns:
- updated builder instance
-
addPrincipal
public Subject.Builder addPrincipal(Principal principal)
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:
- udpated builder instance
-
-