YammerAuthProvider
The ServiceStack Yammer OAuth provider.
<p> This provider is loosely based on the existing ServiceStack's Facebook OAuth provider. </p> <p> For the full info on Yammer's OAuth2 authentication flow, refer to: https://developer.yammer.com/authentication/#a-oauth2 </p> <p> Note: Add these to your application / web config settings under appSettings and replace values as appropriate.
<!-- ServiceStack Yammer OAuth config -->
<add key="oauth.yammer.ClientId" value=""/>
<add key="oauth.yammer.ClientSecret" value=""/>
<add key="oauth.yammer.AccessTokenUrl" value="https://www.yammer.com/oauth2/access_token.json"/>
<add key="oauth.yammer.CallbackUrl" value="~/"/>
<add key="oauth.yammer.PreAuthUrl" value="https://www.yammer.com/dialog/oauth"/>
<add key="oauth.yammer.Realm" value="https://www.yammer.com"/>
<add key="oauth.yammer.RedirectUrl" value="~/auth/yammer"/>
</p>
Assembly: ServiceStack.dll
View Source
public class YammerAuthProvider : OAuthProvider, IAuthPlugin, IOAuthProvider, IAuthProvider
Properties
ClientId
Gets or sets the Yammer OAuth client id.
<p> This provider is loosely based on the existing ServiceStack's Facebook OAuth provider. </p> <p> For the full info on Yammer's OAuth2 authentication flow, refer to: https://developer.yammer.com/authentication/#a-oauth2 </p> <p> Note: Add these to your application / web config settings under appSettings and replace values as appropriate.
<!-- ServiceStack Yammer OAuth config -->
<add key="oauth.yammer.ClientId" value=""/>
<add key="oauth.yammer.ClientSecret" value=""/>
<add key="oauth.yammer.AccessTokenUrl" value="https://www.yammer.com/oauth2/access_token.json"/>
<add key="oauth.yammer.CallbackUrl" value="~/"/>
<add key="oauth.yammer.PreAuthUrl" value="https://www.yammer.com/dialog/oauth"/>
<add key="oauth.yammer.Realm" value="https://www.yammer.com"/>
<add key="oauth.yammer.RedirectUrl" value="~/auth/yammer"/>
</p>
View Source
public string ClientId { get; set; }
ClientSecret
Gets or sets the Yammer OAuth client secret.
<p> This provider is loosely based on the existing ServiceStack's Facebook OAuth provider. </p> <p> For the full info on Yammer's OAuth2 authentication flow, refer to: https://developer.yammer.com/authentication/#a-oauth2 </p> <p> Note: Add these to your application / web config settings under appSettings and replace values as appropriate.
<!-- ServiceStack Yammer OAuth config -->
<add key="oauth.yammer.ClientId" value=""/>
<add key="oauth.yammer.ClientSecret" value=""/>
<add key="oauth.yammer.AccessTokenUrl" value="https://www.yammer.com/oauth2/access_token.json"/>
<add key="oauth.yammer.CallbackUrl" value="~/"/>
<add key="oauth.yammer.PreAuthUrl" value="https://www.yammer.com/dialog/oauth"/>
<add key="oauth.yammer.Realm" value="https://www.yammer.com"/>
<add key="oauth.yammer.RedirectUrl" value="~/auth/yammer"/>
</p>
View Source
public string ClientSecret { get; set; }
PreAuthUrl
Gets or sets the Yammer OAuth pre-auth url.
<p> This provider is loosely based on the existing ServiceStack's Facebook OAuth provider. </p> <p> For the full info on Yammer's OAuth2 authentication flow, refer to: https://developer.yammer.com/authentication/#a-oauth2 </p> <p> Note: Add these to your application / web config settings under appSettings and replace values as appropriate.
<!-- ServiceStack Yammer OAuth config -->
<add key="oauth.yammer.ClientId" value=""/>
<add key="oauth.yammer.ClientSecret" value=""/>
<add key="oauth.yammer.AccessTokenUrl" value="https://www.yammer.com/oauth2/access_token.json"/>
<add key="oauth.yammer.CallbackUrl" value="~/"/>
<add key="oauth.yammer.PreAuthUrl" value="https://www.yammer.com/dialog/oauth"/>
<add key="oauth.yammer.Realm" value="https://www.yammer.com"/>
<add key="oauth.yammer.RedirectUrl" value="~/auth/yammer"/>
</p>
View Source
public string PreAuthUrl { get; set; }
Inherited Properties
AccessTokenUrl
View Source
public string AccessTokenUrl { get; set; }
AuthHttpGateway
View Source
public IAuthHttpGateway AuthHttpGateway { get; set; }
AuthorizeUrl
View Source
public string AuthorizeUrl { get; set; }
ConsumerKey
View Source
public string ConsumerKey { get; set; }
ConsumerSecret
View Source
public string ConsumerSecret { get; set; }
IssuerSigningKeysUrl
View Source
public string IssuerSigningKeysUrl { get; set; }
Meta
View Source
public override Dictionary<string, string> Meta { get; }
OAuthUtils
View Source
public OAuthAuthorizer OAuthUtils { get; set; }
RequestTokenUrl
View Source
public string RequestTokenUrl { get; set; }
Type
View Source
public override string Type { get; }
UserProfileUrl
View Source
public string UserProfileUrl { get; set; }
VerifyAccessTokenAsync
View Source
public Func<string, AuthContext, Task<bool>> VerifyAccessTokenAsync { get; set; }
VerifyTokenUrl
View Source
public string VerifyTokenUrl { get; set; }
Fields
Name
The OAuth provider name / identifier.
<p> This provider is loosely based on the existing ServiceStack's Facebook OAuth provider. </p> <p> For the full info on Yammer's OAuth2 authentication flow, refer to: https://developer.yammer.com/authentication/#a-oauth2 </p> <p> Note: Add these to your application / web config settings under appSettings and replace values as appropriate.
<!-- ServiceStack Yammer OAuth config -->
<add key="oauth.yammer.ClientId" value=""/>
<add key="oauth.yammer.ClientSecret" value=""/>
<add key="oauth.yammer.AccessTokenUrl" value="https://www.yammer.com/oauth2/access_token.json"/>
<add key="oauth.yammer.CallbackUrl" value="~/"/>
<add key="oauth.yammer.PreAuthUrl" value="https://www.yammer.com/dialog/oauth"/>
<add key="oauth.yammer.Realm" value="https://www.yammer.com"/>
<add key="oauth.yammer.RedirectUrl" value="~/auth/yammer"/>
</p>
View Source
public const string Name = "yammer"
Methods
AuthenticateAsync(IServiceBase, IAuthSession, Authenticate, CancellationToken)
Authenticate against Yammer OAuth endpoint.
View Source
public override async Task<object> AuthenticateAsync(IServiceBase authService, IAuthSession session, Authenticate request, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task<System.Object>
:
The System.Object
.
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.IServiceBase | authService |
The auth service.
| | ServiceStack.Auth.IAuthSession | session | The session.
| | ServiceStack.Authenticate | request | The request.
|
| System.Threading.CancellationToken
| token |
|
LoadUserAuthInfoAsync(AuthUserSession, IAuthTokens, Dictionary<String, String>, CancellationToken)
Load the UserAuth info into the session.
View Source
protected override async Task LoadUserAuthInfoAsync(AuthUserSession userSession, IAuthTokens tokens, Dictionary<string, string> authInfo, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.AuthUserSession | userSession |
The User session.
| | ServiceStack.Auth.IAuthTokens | tokens | The OAuth tokens.
|
| System.Collections.Generic.Dictionary<System.String,System.String>
| authInfo |
The auth info.
|
| System.Threading.CancellationToken
| token |
|
LoadUserOAuthProviderAsync(IAuthSession, IAuthTokens)
Load the UserOAuth info into the session.
View Source
public override Task LoadUserOAuthProviderAsync(IAuthSession authSession, IAuthTokens tokens)
Returns
System.Threading.Tasks.Task
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.Auth.IAuthSession | authSession |
The auth session.
| | ServiceStack.Auth.IAuthTokens | tokens | The OAuth tokens.
|
Inherited Methods
AssertConsumerKey()
View Source
protected virtual void AssertConsumerKey()
AssertConsumerSecret()
View Source
protected virtual void AssertConsumerSecret()
AssertValidState()
View Source
protected virtual void AssertValidState()
AuthenticateAsync(IServiceBase, IAuthSession, Authenticate, CancellationToken)
The entry point for all AuthProvider providers. Runs inside the AuthService so exceptions are treated normally. Overridable so you can provide your own Auth implementation.
View Source
public abstract override Task<object> AuthenticateAsync(IServiceBase authService, IAuthSession session, Authenticate request, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task<System.Object>
Parameters
Type | Name |
---|---|
ServiceStack.IServiceBase | authService |
ServiceStack.Auth.IAuthSession | session |
ServiceStack.Authenticate | request |
System.Threading.CancellationToken | token |
Init(IServiceBase, ref IAuthSession, Authenticate)
Sets the CallbackUrl and session.ReferrerUrl if not set and initializes the session tokens for this AuthProvider
View Source
protected IAuthTokens Init(IServiceBase authService, ref IAuthSession session, Authenticate request)
Returns
Parameters
Type | Name |
---|---|
ServiceStack.IServiceBase | authService |
ServiceStack.Auth.IAuthSession | session |
ServiceStack.Authenticate | request |
IsAuthorized(IAuthSession, IAuthTokens, Authenticate)
View Source
public override bool IsAuthorized(IAuthSession session, IAuthTokens tokens, Authenticate request = null)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
ServiceStack.Auth.IAuthSession | session |
ServiceStack.Auth.IAuthTokens | tokens |
ServiceStack.Authenticate | request |
LoadUserOAuthProviderAsync(IAuthSession, IAuthTokens)
View Source
public virtual Task LoadUserOAuthProviderAsync(IAuthSession userSession, IAuthTokens tokens)
Returns
System.Threading.Tasks.Task
Parameters
Type | Name |
---|---|
ServiceStack.Auth.IAuthSession | userSession |
ServiceStack.Auth.IAuthTokens | tokens |