Dangl.Icons
Configuration
In development, ensure that the AppFilesRootPath
setting is configured, ideally via user secrets.
Authorization
Retrieving icons is not access restricted. Icons are saved by a Guid and are accessible
via /api/identicons/{iconId}
. Consuming apps may use anything as identifier. For example,
apps can simply generate a Guid and assign this for an user to be used as identicon. This may be
changed at any time.
Some features require authentication and authorization, for example icon uploads. This app uses Jwt Bearer authentication. Valid authorities and required scopes are configured in the app config, as well as the name of the claim that is required to access this functionality.
Config Value | Type | Description |
---|---|---|
IconManagerClaimName |
string |
The name of the claim that is evaluated for access |
JwtBearerRequiredScope |
string |
The scope required in the Jwt tokens |
JwtBearerAuthorities |
List<string> |
The list of valid authorities that may issue Jwt tokens |
The IconManagerClaimName
may be either set to true
or specify an ISO 8601 timestamp to indicate
until when it is valid.
Authorization via Api Keys
Additionally, it is possible to configure Api Keys to be used as authorization mechanism. To do this,
simply supply an array of valid api keys in the ApiKeys
configuration property.
The keys must be sent with each request in a http header X-DANGL-ICONS-API-KEY
, which is also available
as a constant value in IconManagerRequirementHandler.API_KEY_HEADER_NAME
.
Identicon Generation Options
The /api/identicons/{iconId}
endpoint has the following parameters:
size
to set the rectangle dimensions in pixel for the generated iconsuseSingleColor
to only use a single color for the whole identiconuseMaterialColors
to use Material colors, they are a bit more intensive and match better with Material design stylesuseExtendedBlockConfigurator
to allow the generation of triangles and rotated rectangles instead of only blocks
.NET Client
The Dangl.Icons.Client package contains a DanglIconsServiceCollectionExtensions
class which has extension methods
to configure the clients for dependency injection. This will also attach api keys (if given) to all outgoing requests.
It uses the HttpClientFactory
and is therefore safe to use throughout the lifetime of the application.
Examples
?size=64
&useSingleColor=true
&useMaterialColors=true
&useExtendedBlockConfigurator=true
?size=64
&useSingleColor=false
&useMaterialColors=true
&useExtendedBlockConfigurator=true
?size=64
&useSingleColor=true
&useMaterialColors=true
&useExtendedBlockConfigurator=false
?size=64
&useSingleColor=false
&useMaterialColors=false
&useExtendedBlockConfigurator=true