/** * Provide custom object map to be sent to security providers. * * @param customObjects Class to its instance map of custom objects * @return Updated builder instance * @see #customObject(Class, Object) */ public Builder customObjects(ClassToInstanceStore<Object> customObjects) { this.customObjects.putAll(customObjects); return this; }
private AnalyzerResponse(Builder builder) { this.registry.putAll(builder.registry); this.parent = builder.parent; this.atnResponse = builder.atnResponse; this.atzResponse = builder.atzResponse; this.authenticator = builder.authenticator; this.authorizer = builder.authorizer; }
private TokenCredential(Builder builder) { this.token = builder.token; this.issuer = Optional.ofNullable(builder.issuer); this.issueTime = Optional.ofNullable(builder.issueTime); this.expTime = Optional.ofNullable(builder.expTime); this.tokens.putAll(builder.tokens); }
private Builder customObjects(ClassToInstanceStore<Object> store) { OptionalHelper.from(customObjects) .ifPresentOrElse(myStore -> myStore.putAll(store), () -> { ClassToInstanceStore<Object> ctis = new ClassToInstanceStore<>(); ctis.putAll(store); this.customObjects = Optional.of(ctis); }); return this; }
private EndpointConfig(Builder builder) { this.annotations = Collections.unmodifiableMap(new EnumMap<>(builder.annotations)); this.attributes = BasicAttributes.create(builder.attributes); this.customObjects = new ClassToInstanceStore<>(); this.customObjects.putAll(builder.customObjects); this.configMap = new HashMap<>(builder.configMap); }
/** * Update this builder with all security information from the * subject provided. * * @param subject subject to copy information from * @return updated builder instance */ public Builder update(Subject subject) { principal = subject.principal; grants.addAll(subject.grants); principals.addAll(subject.principals); privateCredentials.putAll(subject.privateCredentials); publicCredentials.putAll(subject.publicCredentials); for (String name : subject.attributes.abacAttributeNames()) { subject.attributes.abacAttribute(name).ifPresent(attrib -> properties.put(name, attrib)); } return this; }
private Subject(Builder builder) { BasicAttributes properties = BasicAttributes.create(builder.properties); this.principal = builder.principal; this.principals.addAll(builder.principals); builder.grants.forEach(grant -> { grants.add(grant); grantsByType.computeIfAbsent(grant.type(), key -> new LinkedList<>()).add(grant); }); properties.put("principal", principal); properties.put("grant", grants); // for each grant type, add grant list grantsByType.forEach(properties::put); this.attributes = properties; this.privateCredentials.putAll(builder.privateCredentials); this.publicCredentials.putAll(builder.publicCredentials); }
private OutboundTarget(Builder builder) { this.name = builder.name; this.transports.addAll(builder.transports); this.hosts.addAll(builder.hosts); this.paths.addAll(builder.paths); this.config = builder.config; this.customObjects.putAll(builder.customObjects); matchAllTransports = this.transports.isEmpty() || anyMatch(this.transports); matchAllHosts = this.hosts.isEmpty() || anyMatch(this.hosts); matchAllPaths = this.paths.isEmpty() || anyMatch(this.paths); if (!matchAllHosts) { //only create patterns for hosts containing * this.hosts .stream() .filter(s -> s.contains("*")) .forEach(host -> hostPatterns.add(toPattern(host))); } if (!matchAllPaths) { this.paths.forEach(path -> pathPatterns.add(Pattern.compile(path))); } }
private SecurityHandler(Builder builder) { // must copy values to be safely immutable this.rolesAllowed = builder.rolesAllowed.flatMap(strings -> { Set<String> newRoles = new HashSet<>(strings); return Optional.of(newRoles); }); // must copy values to be safely immutable this.customObjects = builder.customObjects.flatMap(store -> { ClassToInstanceStore<Object> ctis = new ClassToInstanceStore<>(); ctis.putAll(store); return Optional.of(ctis); }); config = builder.config; explicitAuthenticator = builder.explicitAuthenticator; explicitAuthorizer = builder.explicitAuthorizer; authenticate = builder.authenticate; authenticationOptional = builder.authenticationOptional; audited = builder.audited; auditEventType = builder.auditEventType; auditMessageFormat = builder.auditMessageFormat; authorize = builder.authorize; combined = builder.combined; queryParamHandlers.addAll(builder.queryParamHandlers); config.ifPresent(conf -> conf.asNodeList().get().forEach(node -> configMap.put(node.name(), node))); }
private AnalyzerResponse(Builder builder) { this.registry.putAll(builder.registry); this.parent = builder.parent; this.atnResponse = builder.atnResponse; this.atzResponse = builder.atzResponse; this.authenticator = builder.authenticator; this.authorizer = builder.authorizer; }
private TokenCredential(Builder builder) { this.token = builder.token; this.issuer = Optional.ofNullable(builder.issuer); this.issueTime = Optional.ofNullable(builder.issueTime); this.expTime = Optional.ofNullable(builder.expTime); this.tokens.putAll(builder.tokens); }
private TokenCredential(Builder builder) { this.token = builder.token; this.issuer = Optional.ofNullable(builder.issuer); this.issueTime = Optional.ofNullable(builder.issueTime); this.expTime = Optional.ofNullable(builder.expTime); this.tokens.putAll(builder.tokens); }
private Builder customObjects(ClassToInstanceStore<Object> store) { OptionalHelper.from(customObjects) .ifPresentOrElse(myStore -> myStore.putAll(store), () -> { ClassToInstanceStore<Object> ctis = new ClassToInstanceStore<>(); ctis.putAll(store); this.customObjects = Optional.of(ctis); }); return this; }
private OutboundTarget(Builder builder) { this.name = builder.name; this.transports.addAll(builder.transports); this.hosts.addAll(builder.hosts); this.paths.addAll(builder.paths); this.config = builder.config; this.customObjects.putAll(builder.customObjects); matchAllTransports = this.transports.isEmpty() || anyMatch(this.transports); matchAllHosts = this.hosts.isEmpty() || anyMatch(this.hosts); matchAllPaths = this.paths.isEmpty() || anyMatch(this.paths); if (!matchAllHosts) { //only create patterns for hosts containing * this.hosts .stream() .filter(s -> s.contains("*")) .forEach(host -> hostPatterns.add(toPattern(host))); } if (!matchAllPaths) { this.paths.forEach(path -> pathPatterns.add(Pattern.compile(path))); } }
private OutboundTarget(Builder builder) { this.name = builder.name; this.transports.addAll(builder.transports); this.hosts.addAll(builder.hosts); this.paths.addAll(builder.paths); this.config = builder.config; this.customObjects.putAll(builder.customObjects); matchAllTransports = this.transports.isEmpty() || anyMatch(this.transports); matchAllHosts = this.hosts.isEmpty() || anyMatch(this.hosts); matchAllPaths = this.paths.isEmpty() || anyMatch(this.paths); if (!matchAllHosts) { //only create patterns for hosts containing * this.hosts .stream() .filter(s -> s.contains("*")) .forEach(host -> hostPatterns.add(toPattern(host))); } if (!matchAllPaths) { this.paths.forEach(path -> pathPatterns.add(Pattern.compile(path))); } }
private SecurityHandler(Builder builder) { // must copy values to be safely immutable this.rolesAllowed = builder.rolesAllowed.flatMap(strings -> { Set<String> newRoles = new HashSet<>(strings); return Optional.of(newRoles); }); // must copy values to be safely immutable this.customObjects = builder.customObjects.flatMap(store -> { ClassToInstanceStore<Object> ctis = new ClassToInstanceStore<>(); ctis.putAll(store); return Optional.of(ctis); }); config = builder.config; explicitAuthenticator = builder.explicitAuthenticator; explicitAuthorizer = builder.explicitAuthorizer; authenticate = builder.authenticate; authenticationOptional = builder.authenticationOptional; audited = builder.audited; auditEventType = builder.auditEventType; auditMessageFormat = builder.auditMessageFormat; authorize = builder.authorize; combined = builder.combined; queryParamHandlers.addAll(builder.queryParamHandlers); config.ifPresent(conf -> conf.asNodeList().forEach(node -> configMap.put(node.name(), node))); }