Skip to content

Commit 4ae7387

Browse files
committed
Reapply spotless
1 parent b3631cc commit 4ae7387

File tree

13 files changed

+62
-124
lines changed

13 files changed

+62
-124
lines changed

src/main/java/org/eclipse/biscuit/crypto/Ed25519KeyPair.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
package org.eclipse.biscuit.crypto;
77

88
import java.security.SecureRandom;
9-
import org.eclipse.biscuit.token.builder.Utils;
109
import org.bouncycastle.crypto.AsymmetricCipherKeyPair;
1110
import org.bouncycastle.crypto.generators.Ed25519KeyPairGenerator;
1211
import org.bouncycastle.crypto.params.Ed25519KeyGenerationParameters;
1312
import org.bouncycastle.crypto.params.Ed25519PrivateKeyParameters;
1413
import org.bouncycastle.crypto.params.Ed25519PublicKeyParameters;
1514
import org.bouncycastle.crypto.signers.Ed25519Signer;
15+
import org.eclipse.biscuit.token.builder.Utils;
1616

1717
final class Ed25519KeyPair extends KeyPair {
1818
public static final int SIGNATURE_LENGTH = 64;

src/main/java/org/eclipse/biscuit/crypto/SECP256R1KeyPair.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import java.security.Security;
1212
import java.security.Signature;
1313
import java.security.SignatureException;
14-
import org.eclipse.biscuit.token.builder.Utils;
1514
import org.bouncycastle.jcajce.provider.asymmetric.ec.BCECPrivateKey;
1615
import org.bouncycastle.jcajce.provider.asymmetric.ec.BCECPublicKey;
1716
import org.bouncycastle.jce.ECNamedCurveTable;
@@ -20,6 +19,7 @@
2019
import org.bouncycastle.jce.spec.ECPrivateKeySpec;
2120
import org.bouncycastle.jce.spec.ECPublicKeySpec;
2221
import org.bouncycastle.util.BigIntegers;
22+
import org.eclipse.biscuit.token.builder.Utils;
2323

2424
@SuppressWarnings("checkstyle:AbbreviationAsWordInName")
2525
final class SECP256R1KeyPair extends KeyPair {

src/main/java/org/eclipse/biscuit/token/Authorizer.java

Lines changed: 24 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@
3737
import org.eclipse.biscuit.error.LogicError;
3838
import org.eclipse.biscuit.token.builder.Check;
3939
import org.eclipse.biscuit.token.builder.Expression;
40-
import org.eclipse.biscuit.token.builder.Term;
41-
import org.eclipse.biscuit.token.builder.Utils;
4240
import org.eclipse.biscuit.token.builder.Fact;
4341
import org.eclipse.biscuit.token.builder.Rule;
42+
import org.eclipse.biscuit.token.builder.Term;
43+
import org.eclipse.biscuit.token.builder.Utils;
4444
import org.eclipse.biscuit.token.builder.parser.Parser;
4545

4646
/** Token verification class */
@@ -142,13 +142,11 @@ public void updateOnToken() throws Error.FailedLogic {
142142

143143
for (org.eclipse.biscuit.datalog.Fact fact : token.authority.getFacts()) {
144144
org.eclipse.biscuit.datalog.Fact convertedFact =
145-
Fact.convertFrom(fact, token.symbolTable)
146-
.convert(this.symbolTable);
145+
Fact.convertFrom(fact, token.symbolTable).convert(this.symbolTable);
147146
world.addFact(new Origin(0), convertedFact);
148147
}
149148
for (org.eclipse.biscuit.datalog.Rule rule : token.authority.getRules()) {
150-
Rule locRule =
151-
Rule.convertFrom(rule, token.symbolTable);
149+
Rule locRule = Rule.convertFrom(rule, token.symbolTable);
152150
org.eclipse.biscuit.datalog.Rule convertedRule = locRule.convert(this.symbolTable);
153151

154152
Either<String, Rule> res = locRule.validateVariables();
@@ -176,18 +174,15 @@ public void updateOnToken() throws Error.FailedLogic {
176174

177175
for (org.eclipse.biscuit.datalog.Fact fact : block.getFacts()) {
178176
org.eclipse.biscuit.datalog.Fact convertedFact =
179-
Fact.convertFrom(fact, blockSymbolTable)
180-
.convert(this.symbolTable);
177+
Fact.convertFrom(fact, blockSymbolTable).convert(this.symbolTable);
181178
world.addFact(new Origin(i + 1), convertedFact);
182179
}
183180

184181
for (org.eclipse.biscuit.datalog.Rule rule : block.getRules()) {
185-
Rule syRole =
186-
Rule.convertFrom(rule, blockSymbolTable);
182+
Rule syRole = Rule.convertFrom(rule, blockSymbolTable);
187183
org.eclipse.biscuit.datalog.Rule convertedRule = syRole.convert(this.symbolTable);
188184

189-
Either<String, Rule> res =
190-
syRole.validateVariables();
185+
Either<String, Rule> res = syRole.validateVariables();
191186
if (res.isLeft()) {
192187
throw new Error.FailedLogic(
193188
new LogicError.InvalidBlockRule(0, this.symbolTable.formatRule(convertedRule)));
@@ -223,8 +218,7 @@ public Either<Map<Integer, List<Error>>, Authorizer> addDatalog(String s) {
223218
result = Parser.datalogComponents(s);
224219

225220
if (result.isLeft()) {
226-
Map<Integer, List<org.eclipse.biscuit.token.builder.parser.Error>> errors =
227-
result.getLeft();
221+
Map<Integer, List<org.eclipse.biscuit.token.builder.parser.Error>> errors = result.getLeft();
228222
Map<Integer, List<Error>> errorMap = new HashMap<>();
229223
for (Map.Entry<Integer, List<org.eclipse.biscuit.token.builder.parser.Error>> entry :
230224
errors.entrySet()) {
@@ -264,10 +258,8 @@ public Authorizer addFact(Fact fact) {
264258
}
265259

266260
public Authorizer addFact(String s) throws Error.Parser {
267-
Either<
268-
org.eclipse.biscuit.token.builder.parser.Error,
269-
Tuple2<String, Fact>>
270-
res = Parser.fact(s);
261+
Either<org.eclipse.biscuit.token.builder.parser.Error, Tuple2<String, Fact>> res =
262+
Parser.fact(s);
271263

272264
if (res.isLeft()) {
273265
throw new Error.Parser(res.getLeft());
@@ -288,10 +280,8 @@ public Authorizer addRule(Rule rule) {
288280
}
289281

290282
public Authorizer addRule(String s) throws Error.Parser {
291-
Either<
292-
org.eclipse.biscuit.token.builder.parser.Error,
293-
Tuple2<String, Rule>>
294-
res = Parser.rule(s);
283+
Either<org.eclipse.biscuit.token.builder.parser.Error, Tuple2<String, Rule>> res =
284+
Parser.rule(s);
295285

296286
if (res.isLeft()) {
297287
throw new Error.Parser(res.getLeft());
@@ -313,10 +303,8 @@ public Authorizer addCheck(Check check) {
313303
}
314304

315305
public Authorizer addCheck(String s) throws Error.Parser {
316-
Either<
317-
org.eclipse.biscuit.token.builder.parser.Error,
318-
Tuple2<String, Check>>
319-
res = Parser.check(s);
306+
Either<org.eclipse.biscuit.token.builder.parser.Error, Tuple2<String, Check>> res =
307+
Parser.check(s);
320308

321309
if (res.isLeft()) {
322310
throw new Error.Parser(res.getLeft());
@@ -410,16 +398,13 @@ public Authorizer addScope(Scope s) {
410398
return this;
411399
}
412400

413-
public Set<Fact> query(
414-
Rule query) throws Error {
401+
public Set<Fact> query(Rule query) throws Error {
415402
return this.query(query, new RunLimits());
416403
}
417404

418405
public Set<Fact> query(String s) throws Error {
419-
Either<
420-
org.eclipse.biscuit.token.builder.parser.Error,
421-
Tuple2<String, Rule>>
422-
res = Parser.rule(s);
406+
Either<org.eclipse.biscuit.token.builder.parser.Error, Tuple2<String, Rule>> res =
407+
Parser.rule(s);
423408

424409
if (res.isLeft()) {
425410
throw new Error.Parser(res.getLeft());
@@ -430,8 +415,7 @@ public Set<Fact> query(String s) throws Error {
430415
return query(t._2);
431416
}
432417

433-
public Set<Fact> query(
434-
Rule query, RunLimits limits) throws Error {
418+
public Set<Fact> query(Rule query, RunLimits limits) throws Error {
435419
world.run(limits, symbolTable);
436420

437421
org.eclipse.biscuit.datalog.Rule rule = query.convert(symbolTable);
@@ -446,20 +430,17 @@ public Set<Fact> query(
446430
Set<Fact> s = new HashSet<>();
447431

448432
for (Iterator<org.eclipse.biscuit.datalog.Fact> it = facts.stream().iterator();
449-
it.hasNext(); ) {
433+
it.hasNext(); ) {
450434
org.eclipse.biscuit.datalog.Fact f = it.next();
451435
s.add(Fact.convertFrom(f, symbolTable));
452436
}
453437

454438
return s;
455439
}
456440

457-
public Set<Fact> query(String s, RunLimits limits)
458-
throws Error {
459-
Either<
460-
org.eclipse.biscuit.token.builder.parser.Error,
461-
Tuple2<String, Rule>>
462-
res = Parser.rule(s);
441+
public Set<Fact> query(String s, RunLimits limits) throws Error {
442+
Either<org.eclipse.biscuit.token.builder.parser.Error, Tuple2<String, Rule>> res =
443+
Parser.rule(s);
463444

464445
if (res.isLeft()) {
465446
throw new Error.Parser(res.getLeft());
@@ -529,9 +510,7 @@ public Long authorize(RunLimits limits) throws Error {
529510
for (int j = 0; j < token.authority.getChecks().size(); j++) {
530511
boolean successful = false;
531512

532-
Check c =
533-
Check.convertFrom(
534-
token.authority.getChecks().get(j), token.symbolTable);
513+
Check c = Check.convertFrom(token.authority.getChecks().get(j), token.symbolTable);
535514
org.eclipse.biscuit.datalog.Check check = c.convert(symbolTable);
536515

537516
for (int k = 0; k < check.queries().size(); k++) {
@@ -608,9 +587,7 @@ public Long authorize(RunLimits limits) throws Error {
608587
for (int j = 0; j < b.getChecks().size(); j++) {
609588
boolean successful = false;
610589

611-
Check c =
612-
Check.convertFrom(
613-
b.getChecks().get(j), blockSymbolTable);
590+
Check c = Check.convertFrom(b.getChecks().get(j), blockSymbolTable);
614591
org.eclipse.biscuit.datalog.Check check = c.convert(symbolTable);
615592

616593
for (int k = 0; k < check.queries().size(); k++) {

src/main/java/org/eclipse/biscuit/token/Biscuit.java

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ public final class Biscuit extends UnverifiedBiscuit {
3434
* @param root root private key
3535
* @return
3636
*/
37-
public static org.eclipse.biscuit.token.builder.Biscuit builder(
38-
final Signer root) {
37+
public static org.eclipse.biscuit.token.builder.Biscuit builder(final Signer root) {
3938
return new org.eclipse.biscuit.token.builder.Biscuit(new SecureRandom(), root);
4039
}
4140

@@ -61,9 +60,7 @@ public static org.eclipse.biscuit.token.builder.Biscuit builder(
6160
* @return
6261
*/
6362
public static org.eclipse.biscuit.token.builder.Biscuit builder(
64-
final SecureRandom rng,
65-
final Signer root,
66-
final Option<Integer> rootKeyId) {
63+
final SecureRandom rng, final Signer root, final Option<Integer> rootKeyId) {
6764
return new org.eclipse.biscuit.token.builder.Biscuit(rng, root, rootKeyId);
6865
}
6966

@@ -75,10 +72,7 @@ public static org.eclipse.biscuit.token.builder.Biscuit builder(
7572
* @param authority authority block
7673
* @return Biscuit
7774
*/
78-
public static Biscuit make(
79-
final SecureRandom rng,
80-
final Signer root,
81-
final Block authority)
75+
public static Biscuit make(final SecureRandom rng, final Signer root, final Block authority)
8276
throws Error.FormatError {
8377
return Biscuit.make(rng, root, Option.none(), authority);
8478
}
@@ -92,10 +86,7 @@ public static Biscuit make(
9286
* @return Biscuit
9387
*/
9488
public static Biscuit make(
95-
final SecureRandom rng,
96-
final Signer root,
97-
final Integer rootKeyId,
98-
final Block authority)
89+
final SecureRandom rng, final Signer root, final Integer rootKeyId, final Block authority)
9990
throws Error.FormatError {
10091
return Biscuit.make(rng, root, Option.of(rootKeyId), authority);
10192
}
@@ -315,9 +306,7 @@ public Biscuit attenuate(org.eclipse.biscuit.token.builder.Block block, Algorith
315306
}
316307

317308
public Biscuit attenuate(
318-
final SecureRandom rng,
319-
final KeyPair keypair,
320-
org.eclipse.biscuit.token.builder.Block block)
309+
final SecureRandom rng, final KeyPair keypair, org.eclipse.biscuit.token.builder.Block block)
321310
throws Error {
322311
SymbolTable builderSymbols = new SymbolTable(this.symbolTable);
323312
return attenuate(rng, keypair, block.build(builderSymbols));

src/main/java/org/eclipse/biscuit/token/builder/Biscuit.java

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,7 @@ public Biscuit(final SecureRandom rng, final Signer root) {
4343
this.rootKeyId = Option.none();
4444
}
4545

46-
public Biscuit(
47-
final SecureRandom rng,
48-
final Signer root,
49-
Option<Integer> rootKeyId) {
46+
public Biscuit(final SecureRandom rng, final Signer root, Option<Integer> rootKeyId) {
5047
this.rng = rng;
5148
this.root = root;
5249
this.context = "";
@@ -72,18 +69,15 @@ public Biscuit(
7269
this.scopes = block.scopes();
7370
}
7471

75-
public Biscuit addAuthorityFact(Fact f)
76-
throws Error.Language {
72+
public Biscuit addAuthorityFact(Fact f) throws Error.Language {
7773
f.validate();
7874
this.facts.add(f);
7975
return this;
8076
}
8177

8278
public Biscuit addAuthorityFact(String s) throws Error.Parser, Error.Language {
83-
Either<
84-
org.eclipse.biscuit.token.builder.parser.Error,
85-
Tuple2<String, Fact>>
86-
res = Parser.fact(s);
79+
Either<org.eclipse.biscuit.token.builder.parser.Error, Tuple2<String, Fact>> res =
80+
Parser.fact(s);
8781

8882
if (res.isLeft()) {
8983
throw new Error.Parser(res.getLeft());
@@ -100,10 +94,8 @@ public Biscuit addAuthorityRule(Rule rule) {
10094
}
10195

10296
public Biscuit addAuthorityRule(String s) throws Error.Parser {
103-
Either<
104-
org.eclipse.biscuit.token.builder.parser.Error,
105-
Tuple2<String, Rule>>
106-
res = Parser.rule(s);
97+
Either<org.eclipse.biscuit.token.builder.parser.Error, Tuple2<String, Rule>> res =
98+
Parser.rule(s);
10799

108100
if (res.isLeft()) {
109101
throw new Error.Parser(res.getLeft());
@@ -120,10 +112,8 @@ public Biscuit addAuthorityCheck(Check c) {
120112
}
121113

122114
public Biscuit addAuthorityCheck(String s) throws Error.Parser {
123-
Either<
124-
org.eclipse.biscuit.token.builder.parser.Error,
125-
Tuple2<String, Check>>
126-
res = Parser.check(s);
115+
Either<org.eclipse.biscuit.token.builder.parser.Error, Tuple2<String, Check>> res =
116+
Parser.check(s);
127117

128118
if (res.isLeft()) {
129119
throw new Error.Parser(res.getLeft());

src/main/java/org/eclipse/biscuit/token/builder/Block.java

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,8 @@ public Block addFact(Fact f) {
5151
}
5252

5353
public Block addFact(String s) throws Error.Parser {
54-
Either<
55-
org.eclipse.biscuit.token.builder.parser.Error,
56-
Tuple2<String, Fact>>
57-
res = Parser.fact(s);
54+
Either<org.eclipse.biscuit.token.builder.parser.Error, Tuple2<String, Fact>> res =
55+
Parser.fact(s);
5856

5957
if (res.isLeft()) {
6058
throw new Error.Parser(res.getLeft());
@@ -71,10 +69,8 @@ public Block addRule(Rule rule) {
7169
}
7270

7371
public Block addRule(String s) throws Error.Parser {
74-
Either<
75-
org.eclipse.biscuit.token.builder.parser.Error,
76-
Tuple2<String, Rule>>
77-
res = Parser.rule(s);
72+
Either<org.eclipse.biscuit.token.builder.parser.Error, Tuple2<String, Rule>> res =
73+
Parser.rule(s);
7874

7975
if (res.isLeft()) {
8076
throw new Error.Parser(res.getLeft());
@@ -91,10 +87,8 @@ public Block addCheck(Check check) {
9187
}
9288

9389
public Block addCheck(String s) throws Error.Parser {
94-
Either<
95-
org.eclipse.biscuit.token.builder.parser.Error,
96-
Tuple2<String, Check>>
97-
res = Parser.check(s);
90+
Either<org.eclipse.biscuit.token.builder.parser.Error, Tuple2<String, Check>> res =
91+
Parser.check(s);
9892

9993
if (res.isLeft()) {
10094
throw new Error.Parser(res.getLeft());

src/main/java/org/eclipse/biscuit/token/builder/Expression.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,15 @@
1414

1515
public abstract class Expression {
1616

17-
public final org.eclipse.biscuit.datalog.expressions.Expression convert(
18-
SymbolTable symbolTable) {
17+
public final org.eclipse.biscuit.datalog.expressions.Expression convert(SymbolTable symbolTable) {
1918
ArrayList<org.eclipse.biscuit.datalog.expressions.Op> ops = new ArrayList<>();
2019
this.toOpcodes(symbolTable, ops);
2120

2221
return new org.eclipse.biscuit.datalog.expressions.Expression(ops);
2322
}
2423

2524
public static Expression convertFrom(
26-
org.eclipse.biscuit.datalog.expressions.Expression e, SymbolTable symbolTable) {
25+
org.eclipse.biscuit.datalog.expressions.Expression e, SymbolTable symbolTable) {
2726
ArrayList<Op> ops = new ArrayList<>();
2827
Deque<Expression> stack = new ArrayDeque<Expression>(16);
2928
for (org.eclipse.biscuit.datalog.expressions.Op op : e.getOps()) {

src/main/java/org/eclipse/biscuit/token/builder/Predicate.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public org.eclipse.biscuit.datalog.Predicate convert(SymbolTable symbolTable) {
3939
}
4040

4141
public static Predicate convertFrom(
42-
org.eclipse.biscuit.datalog.Predicate p, SymbolTable symbolTable) {
42+
org.eclipse.biscuit.datalog.Predicate p, SymbolTable symbolTable) {
4343
String name = symbolTable.formatSymbol((int) p.name());
4444
List<Term> terms = new ArrayList<>();
4545
for (org.eclipse.biscuit.datalog.Term t : p.terms()) {

0 commit comments

Comments
 (0)