public abstract class AbstractStatementRetriever extends Object
An asset is an identifiable and addressable online entity that typically provides some service or content. Examples of assets are websites, Android apps, Twitter feeds, and Plus Pages.
Ownership of an asset is defined by being able to control it and speak for it. An asset owner may establish a relationship between the asset and another asset by making a statement about an intended relationship between the two. An example of a relationship is permission delegation. For example, the owner of a website (the webmaster) may delegate the ability the handle URLs to a particular mobile app. Relationships are considered public information.
A particular kind of relationship (like permission delegation) defines a binary relation on assets. The relation is not symmetric or transitive, nor is it antisymmetric or anti-transitive.
A statement S(r, a, b) is an assertion that the relation r holds for the ordered pair of assets (a, b). For example, taking r = "delegates permission to view user's location", a = New York Times mobile app, b = nytimes.com website, S(r, a, b) would be an assertion that "the New York Times mobile app delegates its ability to use the user's location to the nytimes.com website".
A statement S(r, a, b) is considered reliable if we have confidence that the statement is true; the exact criterion depends on the kind of statement, since some kinds of statements may be true on their face whereas others may require multiple parties to agree.
For example, to get the statements made by www.example.com use:
result = retrieveStatements(AssetFactory.create( "{\"namespace\": \"web\", \"site\": \"https://www.google.com\"}"))
result
will contain the statements and the expiration time of this result. The statements
are considered reliable until the expiration time.Modifier and Type | Class and Description |
---|---|
static interface |
AbstractStatementRetriever.Result
The retrieved statements and the expiration date.
|
Constructor and Description |
---|
AbstractStatementRetriever() |
Modifier and Type | Method and Description |
---|---|
static AbstractStatementRetriever |
createDirectRetriever(Context context)
Creates a new StatementRetriever that directly retrieves statements from the asset.
|
abstract AbstractStatementRetriever.Result |
retrieveStatements(AbstractAsset source)
Returns the statements made by the
source asset with ttl. |
public abstract AbstractStatementRetriever.Result retrieveStatements(AbstractAsset source) throws AssociationServiceException
source
asset with ttl.AssociationServiceException
- if the asset namespace is not supported.public static AbstractStatementRetriever createDirectRetriever(Context context)
For web assets, AbstractStatementRetriever
will try to retrieve the statement
file from URL: [webAsset.site]/.well-known/assetlinks.json"
where [webAsset.site]
is in the form http{s}://[hostname]:[optional_port]
. The file
should contain one JSON array of statements.
For Android assets, AbstractStatementRetriever
will try to retrieve the statement
from the AndroidManifest.xml. The developer should add a meta-data
tag under
application
tag where attribute android:name
equals "associated_assets"
and android:recourse
points to a string array resource. Each entry in the string
array should contain exactly one statement in JSON format. Note that this implementation
can only return statements made by installed apps.