|
| 1 | +namespace net.openstack.Core.Providers |
| 2 | +{ |
| 3 | + using System; |
| 4 | + using System.Threading.Tasks; |
| 5 | + using net.openstack.Core.Domain; |
| 6 | + using net.openstack.Core.Exceptions.Response; |
| 7 | + using CancellationToken = System.Threading.CancellationToken; |
| 8 | + |
| 9 | + /// <summary> |
| 10 | + /// Represents a provider for asynchronous operations on the OpenStack Identity Service. |
| 11 | + /// </summary> |
| 12 | + /// <seealso href="http://docs.openstack.org/api/openstack-identity-service/2.0/content/">OpenStack Identity Service API v2.0 Reference</seealso> |
| 13 | + /// <preliminary/> |
| 14 | + public interface IIdentityService |
| 15 | + { |
| 16 | + /// <summary> |
| 17 | + /// Authenticates the user for the specified identity. |
| 18 | + /// </summary> |
| 19 | + /// <remarks> |
| 20 | + /// This method always authenticates to the server, even if an unexpired, cached <see cref="UserAccess"/> |
| 21 | + /// is available for the specified identity. |
| 22 | + /// </remarks> |
| 23 | + /// <param name="identity">The identity of the user to authenticate.</param> |
| 24 | + /// <param name="cancellationToken">The <see cref="CancellationToken"/> that the task will observe.</param> |
| 25 | + /// <returns>A <see cref="Task"/> object representing the asynchronous operation. When the task completes successfully, the <see cref="Task{TResult}.Result"/> property will contain a <see cref="UserAccess"/> object containing the authentication token, service catalog and user data.</returns> |
| 26 | + /// <exception cref="NotSupportedException">If the provider does not support the given <paramref name="identity"/> type.</exception> |
| 27 | + /// <exception cref="InvalidOperationException">If <paramref name="identity"/> is <c>null</c> and no default identity is available for the provider.</exception> |
| 28 | + /// <exception cref="ResponseException">If the authentication request failed.</exception> |
| 29 | + /// <seealso href="http://docs.openstack.org/api/openstack-identity-service/2.0/content/POST_authenticate_v2.0_tokens_.html">Authenticate (OpenStack Identity Service API v2.0 Reference)</seealso> |
| 30 | + Task<UserAccess> AuthenticateAsync(CloudIdentity identity, CancellationToken cancellationToken); |
| 31 | + |
| 32 | + /// <summary> |
| 33 | + /// Gets the user access details, authenticating with the server if necessary. |
| 34 | + /// </summary> |
| 35 | + /// <remarks> |
| 36 | + /// If <paramref name="forceCacheRefresh"/> is <c>false</c> and a cached <see cref="UserAccess"/> |
| 37 | + /// is available for the specified <paramref name="identity"/>, this method may return the cached |
| 38 | + /// value without performing an authentication against the server. If <paramref name="forceCacheRefresh"/> |
| 39 | + /// is <c>true</c>, this method is equivalent to <see cref="AuthenticateAsync"/>. |
| 40 | + /// </remarks> |
| 41 | + /// <param name="identity">The identity of the user to authenticate.</param> |
| 42 | + /// <param name="forceCacheRefresh">If <c>true</c>, the user is always authenticated against the server; otherwise a cached <see cref="IdentityToken"/> may be returned.</param> |
| 43 | + /// <param name="cancellationToken">The <see cref="CancellationToken"/> that the task will observe.</param> |
| 44 | + /// <returns>A <see cref="Task"/> object representing the asynchronous operation. When the task completes successfully, the <see cref="Task{TResult}.Result"/> property will contain a <see cref="UserAccess"/> object containing the authentication token, service catalog and user data.</returns> |
| 45 | + /// <exception cref="NotSupportedException">If the provider does not support the given <paramref name="identity"/> type.</exception> |
| 46 | + /// <exception cref="InvalidOperationException">If <paramref name="identity"/> is <c>null</c> and no default identity is available for the provider.</exception> |
| 47 | + /// <exception cref="ResponseException">If the REST API request failed.</exception> |
| 48 | + /// <seealso href="http://docs.openstack.org/api/openstack-identity-service/2.0/content/POST_authenticate_v2.0_tokens_.html">Authenticate (OpenStack Identity Service API v2.0 Reference)</seealso> |
| 49 | + Task<UserAccess> GetUserAccessAsync(CloudIdentity identity, bool forceCacheRefresh, CancellationToken cancellationToken); |
| 50 | + |
| 51 | + /// <summary> |
| 52 | + /// Gets the authentication token for the specified identity. If necessary, the identity is authenticated |
| 53 | + /// on the server to obtain a token. |
| 54 | + /// </summary> |
| 55 | + /// <remarks> |
| 56 | + /// If a cached <see cref="IdentityToken"/> is available for the specified <paramref name="identity"/>, |
| 57 | + /// this method may return the cached value without performing an authentication against the server. |
| 58 | + /// </remarks> |
| 59 | + /// <param name="identity">The identity of the user to authenticate.</param> |
| 60 | + /// <param name="cancellationToken">The <see cref="CancellationToken"/> that the task will observe.</param> |
| 61 | + /// <returns>A <see cref="Task"/> object representing the asynchronous operation. When the task completes successfully, the <see cref="Task{TResult}.Result"/> property will contain the user's authentication token.</returns> |
| 62 | + /// <exception cref="NotSupportedException">If the provider does not support the given <paramref name="identity"/> type.</exception> |
| 63 | + /// <exception cref="InvalidOperationException">If <paramref name="identity"/> is <c>null</c> and no default identity is available for the provider.</exception> |
| 64 | + /// <exception cref="ResponseException">If the authentication request failed.</exception> |
| 65 | + /// <seealso href="http://docs.openstack.org/api/openstack-identity-service/2.0/content/POST_authenticate_v2.0_tokens_.html">Authenticate (OpenStack Identity Service API v2.0 Reference)</seealso> |
| 66 | + Task<IdentityToken> GetTokenAsync(CloudIdentity identity, CancellationToken cancellationToken); |
| 67 | + } |
| 68 | +} |
0 commit comments