-
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Incorporate latest changes from WebDAV-Push (#60)
* Updated Push namespace Signed-off-by: Arnau Mora Gras <[email protected]> * Implemented updates from new definitions Signed-off-by: Arnau Mora Gras <[email protected]> * Added encryption properties Signed-off-by: Arnau Mora Gras <[email protected]> * Added generic public key class Signed-off-by: Arnau Mora Gras <[email protected]> * Replaced namespaces in docs Signed-off-by: Arnau Mora Gras <[email protected]> * Got rid of unused const Signed-off-by: Arnau Mora Gras <[email protected]> * Formatting Signed-off-by: Arnau Mora Gras <[email protected]> * Moved file Signed-off-by: Arnau Mora Gras <[email protected]> * Got rid of `PushPublicKey.Factory` Signed-off-by: Arnau Mora Gras <[email protected]> * Renamed `resource` to `uri` Signed-off-by: Arnau Mora Gras <[email protected]> * Simplified expression Signed-off-by: Arnau Mora Gras <[email protected]> * Added `ServerPublicKey` to test Signed-off-by: Arnau Mora Gras <[email protected]> * Typos Signed-off-by: Arnau Mora Gras <[email protected]> * Made all properties data classes to comply with #61 Signed-off-by: Arnau Mora Gras <[email protected]> * Fixed constructor Signed-off-by: Arnau Mora Gras <[email protected]> * Minor changes (drop PushPublicKey) --------- Signed-off-by: Arnau Mora Gras <[email protected]> Co-authored-by: Ricki Hirner <[email protected]>
- Loading branch information
1 parent
fbd95a5
commit 8b59413
Showing
16 changed files
with
409 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
src/main/kotlin/at/bitfire/dav4jvm/property/push/AuthSecret.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
*/ | ||
|
||
package at.bitfire.dav4jvm.property.push | ||
|
||
import at.bitfire.dav4jvm.Property | ||
import at.bitfire.dav4jvm.PropertyFactory | ||
import at.bitfire.dav4jvm.XmlReader | ||
import org.xmlpull.v1.XmlPullParser | ||
|
||
/** | ||
* Represents a [NS_WEBDAV_PUSH]`:auth-secret` property. | ||
* | ||
* Experimental! See https://github.com/bitfireAT/webdav-push/ | ||
*/ | ||
data class AuthSecret( | ||
val secret: String? = null | ||
): Property { | ||
|
||
companion object { | ||
|
||
@JvmField | ||
val NAME = Property.Name(NS_WEBDAV_PUSH, "auth-secret") | ||
|
||
} | ||
|
||
|
||
object Factory: PropertyFactory { | ||
|
||
override fun getName() = NAME | ||
|
||
override fun create(parser: XmlPullParser): AuthSecret = | ||
AuthSecret(XmlReader(parser).readText()) | ||
|
||
} | ||
|
||
} |
39 changes: 39 additions & 0 deletions
39
src/main/kotlin/at/bitfire/dav4jvm/property/push/ClientPublicKey.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package at.bitfire.dav4jvm.property.push | ||
|
||
import at.bitfire.dav4jvm.Property | ||
import at.bitfire.dav4jvm.PropertyFactory | ||
import at.bitfire.dav4jvm.XmlReader | ||
import org.xmlpull.v1.XmlPullParser | ||
|
||
/** | ||
* Represents a [NS_WEBDAV_PUSH]`:client-public-key` property. | ||
* | ||
* Experimental! See https://github.com/bitfireAT/webdav-push/ | ||
*/ | ||
data class ClientPublicKey( | ||
val type: String? = null, | ||
val key: String? = null | ||
): Property { | ||
|
||
companion object { | ||
|
||
@JvmField | ||
val NAME = Property.Name(NS_WEBDAV_PUSH, "client-public-key") | ||
|
||
} | ||
|
||
|
||
object Factory : PropertyFactory { | ||
|
||
override fun getName() = NAME | ||
|
||
override fun create(parser: XmlPullParser): ClientPublicKey { | ||
return ClientPublicKey( | ||
type = parser.getAttributeValue(null, "type"), | ||
key = XmlReader(parser).readText() | ||
) | ||
} | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
src/main/kotlin/at/bitfire/dav4jvm/property/push/PushResource.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
*/ | ||
|
||
package at.bitfire.dav4jvm.property.push | ||
|
||
import at.bitfire.dav4jvm.Property | ||
import at.bitfire.dav4jvm.PropertyFactory | ||
import at.bitfire.dav4jvm.XmlReader | ||
import org.xmlpull.v1.XmlPullParser | ||
import java.net.URI | ||
import java.net.URISyntaxException | ||
|
||
/** | ||
* Represents a [NS_WEBDAV_PUSH]`:push-resource` property. | ||
* | ||
* Experimental! See https://github.com/bitfireAT/webdav-push/ | ||
*/ | ||
data class PushResource( | ||
val uri: URI? = null | ||
): Property { | ||
|
||
companion object { | ||
|
||
@JvmField | ||
val NAME = Property.Name(NS_WEBDAV_PUSH, "push-resource") | ||
|
||
} | ||
|
||
|
||
object Factory: PropertyFactory { | ||
|
||
override fun getName() = NAME | ||
|
||
override fun create(parser: XmlPullParser): PushResource = | ||
PushResource( | ||
uri = XmlReader(parser).readText()?.let { uri -> | ||
try { | ||
URI(uri) | ||
} catch (_: URISyntaxException) { | ||
null | ||
} | ||
} | ||
) | ||
|
||
} | ||
|
||
} |
8 changes: 8 additions & 0 deletions
8
src/main/kotlin/at/bitfire/dav4jvm/property/push/PushTransport.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package at.bitfire.dav4jvm.property.push | ||
|
||
import at.bitfire.dav4jvm.Property | ||
|
||
/** | ||
* Identifies a property as a push transport. | ||
*/ | ||
interface PushTransport: Property |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
src/main/kotlin/at/bitfire/dav4jvm/property/push/ServerPublicKey.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package at.bitfire.dav4jvm.property.push | ||
|
||
import at.bitfire.dav4jvm.Property | ||
import at.bitfire.dav4jvm.PropertyFactory | ||
import at.bitfire.dav4jvm.XmlReader | ||
import org.xmlpull.v1.XmlPullParser | ||
|
||
/** | ||
* Represents a [NS_WEBDAV_PUSH]`:server-public-key` property. | ||
* | ||
* Experimental! See https://github.com/bitfireAT/webdav-push/ | ||
*/ | ||
data class ServerPublicKey( | ||
val type: String? = null, | ||
val key: String? = null | ||
): Property { | ||
|
||
companion object { | ||
|
||
@JvmField | ||
val NAME = Property.Name(NS_WEBDAV_PUSH, "server-public-key") | ||
|
||
} | ||
|
||
|
||
object Factory : PropertyFactory { | ||
|
||
override fun getName() = NAME | ||
|
||
override fun create(parser: XmlPullParser): ServerPublicKey { | ||
return ServerPublicKey( | ||
type = parser.getAttributeValue(null, "type"), | ||
key = XmlReader(parser).readText() | ||
) | ||
} | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.