public class PushCertificateParser extends Object
| Constructor and Description |
|---|
PushCertificateParser(Repository into,
SignedPushConfig cfg)
Constructor for PushCertificateParser.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addCommand(ReceiveCommand cmd)
Add a command to the signature.
|
void |
addCommand(String line)
Add a command to the signature.
|
PushCertificate |
build()
Build the parsed certificate
|
boolean |
enabled()
Whether the repository is configured to use signed pushes in this
context.
|
static PushCertificate |
fromReader(Reader r)
Parse a push certificate from a reader.
|
static PushCertificate |
fromString(String str)
Parse a push certificate from a string.
|
String |
getAdvertiseNonce()
Get the whole string for the nonce to be included into the capability
advertisement
|
PushCertificate |
parse(Reader r)
Parse a push certificate from a reader.
|
void |
receiveHeader(PacketLineIn pckIn,
boolean stateless)
Receive a list of commands from the input encapsulated in a push
certificate.
|
void |
receiveSignature(PacketLineIn pckIn)
Read the PGP signature.
|
public PushCertificateParser(Repository into, SignedPushConfig cfg)
Constructor for PushCertificateParser.
into - destination repository for the push.cfg - configuration for signed push.public static PushCertificate fromReader(Reader r) throws PackProtocolException, IOException
Differences from the PacketLineIn
receiver methods:
"push-cert-end" line.r - input reader; consumed only up until the end of the next
signature in the input.PackProtocolException - if the certificate is malformed.IOException - if there was an error reading from the input.public static PushCertificate fromString(String str) throws PackProtocolException, IOException
str - input string.PackProtocolException - if the certificate is malformed.IOException - if there was an error reading from the input.fromReader(Reader)public PushCertificate parse(Reader r) throws PackProtocolException, IOException
r - input reader; consumed only up until the end of the next
signature in the input.PackProtocolException - if the certificate is malformed.IOException - if there was an error reading from the input.fromReader(Reader)public PushCertificate build() throws IOException
IOException - if the push certificate has missing or invalid fields.public boolean enabled()
public String getAdvertiseNonce()
public void receiveHeader(PacketLineIn pckIn, boolean stateless) throws IOException
This method doesn't parse the first line "push-cert \NUL
<capabilities>", but assumes the first line including the
capabilities has already been handled by the caller.
pckIn - where we take the push certificate header from.stateless - affects nonce verification. When stateless = true the
NonceGenerator will allow for some time skew caused by
clients disconnected and reconnecting in the stateless smart
HTTP protocol.IOException - if the certificate from the client is badly malformed or the
client disconnects before sending the entire certificate.public void receiveSignature(PacketLineIn pckIn) throws IOException
This method assumes the line
"-----BEGIN PGP SIGNATURE-----" has already been parsed,
and continues parsing until an "-----END PGP SIGNATURE-----" is
found, followed by "push-cert-end".
pckIn - where we read the signature from.IOException - if the signature is invalid.public void addCommand(ReceiveCommand cmd)
cmd - the command.public void addCommand(String line) throws PackProtocolException
line - the line read from the wire that produced this
command, with optional trailing newline already trimmed.PackProtocolException - if the raw line cannot be parsed to a command.Copyright © 2021 Eclipse JGit Project. All rights reserved.