-
Notifications
You must be signed in to change notification settings - Fork 0
1.1.2 Authorization Class
Anders Mikkelsen edited this page Dec 21, 2017
·
2 revisions
The Authorization class is used for producing a simple auth model.
@DataObject(generateConverter = true)
public class Authorization {
private String model;
private String method;
private String domainIdentifier;
public Authorization() {}
public Authorization(JsonObject jsonObject) {
fromJson(jsonObject, this);
}
public JsonObject toJson() {
return JsonObject.mapFrom(this);
}
public boolean validate() {
return (domainIdentifier != null &&
(domainIdentifier.equals(VALIDATION_REQUEST) || domainIdentifier.equals(GLOBAL_AUTHORIZATION)) ||
(model != null && method != null && domainIdentifier != null));
}
public String getModel() {
return model;
}
@Fluent
public Authorization setModel(String model) {
this.model = model;
return this;
}
public String getMethod() {
return method;
}
@Fluent
public Authorization setMethod(String method) {
this.method = method;
return this;
}
public String getDomainIdentifier() {
return domainIdentifier;
}
@Fluent
public Authorization setDomainIdentifier(String domainIdentifier) {
this.domainIdentifier = domainIdentifier;
return this;
}
public static Authorization global() {
return new Authorization().setDomainIdentifier(VALIDATION_REQUEST);
}
}