Skip to main content

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.

&lt;!-- ServiceStack Yammer OAuth config --&gt;
&lt;add key=&quot;oauth.yammer.ClientId&quot; value=&quot;&quot;/&gt;
&lt;add key=&quot;oauth.yammer.ClientSecret&quot; value=&quot;&quot;/&gt;
&lt;add key=&quot;oauth.yammer.AccessTokenUrl&quot; value=&quot;https://www.yammer.com/oauth2/access_token.json&quot;/&gt;
&lt;add key=&quot;oauth.yammer.CallbackUrl&quot; value=&quot;~/&quot;/&gt;
&lt;add key=&quot;oauth.yammer.PreAuthUrl&quot; value=&quot;https://www.yammer.com/dialog/oauth&quot;/&gt;
&lt;add key=&quot;oauth.yammer.Realm&quot; value=&quot;https://www.yammer.com&quot;/&gt;
&lt;add key=&quot;oauth.yammer.RedirectUrl&quot; value=&quot;~/auth/yammer&quot;/&gt;

</p>

Assembly: ServiceStack.dll​
View Source​
Declaration
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.

&lt;!-- ServiceStack Yammer OAuth config --&gt;
&lt;add key=&quot;oauth.yammer.ClientId&quot; value=&quot;&quot;/&gt;
&lt;add key=&quot;oauth.yammer.ClientSecret&quot; value=&quot;&quot;/&gt;
&lt;add key=&quot;oauth.yammer.AccessTokenUrl&quot; value=&quot;https://www.yammer.com/oauth2/access_token.json&quot;/&gt;
&lt;add key=&quot;oauth.yammer.CallbackUrl&quot; value=&quot;~/&quot;/&gt;
&lt;add key=&quot;oauth.yammer.PreAuthUrl&quot; value=&quot;https://www.yammer.com/dialog/oauth&quot;/&gt;
&lt;add key=&quot;oauth.yammer.Realm&quot; value=&quot;https://www.yammer.com&quot;/&gt;
&lt;add key=&quot;oauth.yammer.RedirectUrl&quot; value=&quot;~/auth/yammer&quot;/&gt;

</p>

View Source​
Declaration
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.

&lt;!-- ServiceStack Yammer OAuth config --&gt;
&lt;add key=&quot;oauth.yammer.ClientId&quot; value=&quot;&quot;/&gt;
&lt;add key=&quot;oauth.yammer.ClientSecret&quot; value=&quot;&quot;/&gt;
&lt;add key=&quot;oauth.yammer.AccessTokenUrl&quot; value=&quot;https://www.yammer.com/oauth2/access_token.json&quot;/&gt;
&lt;add key=&quot;oauth.yammer.CallbackUrl&quot; value=&quot;~/&quot;/&gt;
&lt;add key=&quot;oauth.yammer.PreAuthUrl&quot; value=&quot;https://www.yammer.com/dialog/oauth&quot;/&gt;
&lt;add key=&quot;oauth.yammer.Realm&quot; value=&quot;https://www.yammer.com&quot;/&gt;
&lt;add key=&quot;oauth.yammer.RedirectUrl&quot; value=&quot;~/auth/yammer&quot;/&gt;

</p>

View Source​
Declaration
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.

&lt;!-- ServiceStack Yammer OAuth config --&gt;
&lt;add key=&quot;oauth.yammer.ClientId&quot; value=&quot;&quot;/&gt;
&lt;add key=&quot;oauth.yammer.ClientSecret&quot; value=&quot;&quot;/&gt;
&lt;add key=&quot;oauth.yammer.AccessTokenUrl&quot; value=&quot;https://www.yammer.com/oauth2/access_token.json&quot;/&gt;
&lt;add key=&quot;oauth.yammer.CallbackUrl&quot; value=&quot;~/&quot;/&gt;
&lt;add key=&quot;oauth.yammer.PreAuthUrl&quot; value=&quot;https://www.yammer.com/dialog/oauth&quot;/&gt;
&lt;add key=&quot;oauth.yammer.Realm&quot; value=&quot;https://www.yammer.com&quot;/&gt;
&lt;add key=&quot;oauth.yammer.RedirectUrl&quot; value=&quot;~/auth/yammer&quot;/&gt;

</p>

View Source​
Declaration
public string PreAuthUrl { get; set; }

Inherited Properties​

AccessTokenUrl​

View Source​
Declaration
public string AccessTokenUrl { get; set; }

AuthHttpGateway​

View Source​
Declaration
public IAuthHttpGateway AuthHttpGateway { get; set; }

AuthorizeUrl​

View Source​
Declaration
public string AuthorizeUrl { get; set; }

ConsumerKey​

View Source​
Declaration
public string ConsumerKey { get; set; }

ConsumerSecret​

View Source​
Declaration
public string ConsumerSecret { get; set; }

IssuerSigningKeysUrl​

View Source​
Declaration
public string IssuerSigningKeysUrl { get; set; }

Meta​

View Source​
Declaration
public override Dictionary<string, string> Meta { get; }

OAuthUtils​

View Source​
Declaration
public OAuthAuthorizer OAuthUtils { get; set; }

RequestTokenUrl​

View Source​
Declaration
public string RequestTokenUrl { get; set; }

Type​

View Source​
Declaration
public override string Type { get; }

UserProfileUrl​

View Source​
Declaration
public string UserProfileUrl { get; set; }

VerifyAccessTokenAsync​

View Source​
Declaration
public Func<string, AuthContext, Task<bool>> VerifyAccessTokenAsync { get; set; }

VerifyTokenUrl​

View Source​
Declaration
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.

&lt;!-- ServiceStack Yammer OAuth config --&gt;
&lt;add key=&quot;oauth.yammer.ClientId&quot; value=&quot;&quot;/&gt;
&lt;add key=&quot;oauth.yammer.ClientSecret&quot; value=&quot;&quot;/&gt;
&lt;add key=&quot;oauth.yammer.AccessTokenUrl&quot; value=&quot;https://www.yammer.com/oauth2/access_token.json&quot;/&gt;
&lt;add key=&quot;oauth.yammer.CallbackUrl&quot; value=&quot;~/&quot;/&gt;
&lt;add key=&quot;oauth.yammer.PreAuthUrl&quot; value=&quot;https://www.yammer.com/dialog/oauth&quot;/&gt;
&lt;add key=&quot;oauth.yammer.Realm&quot; value=&quot;https://www.yammer.com&quot;/&gt;
&lt;add key=&quot;oauth.yammer.RedirectUrl&quot; value=&quot;~/auth/yammer&quot;/&gt;

</p>

View Source​
Declaration
public const string Name = "yammer"

Methods​

AuthenticateAsync(IServiceBase, IAuthSession, Authenticate, CancellationToken)​

Authenticate against Yammer OAuth endpoint.

View Source​
Declaration
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​
TypeNameDescription
ServiceStack.IServiceBaseauthService

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​
Declaration
protected override async Task LoadUserAuthInfoAsync(AuthUserSession userSession, IAuthTokens tokens, Dictionary<string, string> authInfo, CancellationToken token = default(CancellationToken))
Returns​

System.Threading.Tasks.Task

Parameters​
TypeNameDescription
ServiceStack.AuthUserSessionuserSession

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​
Declaration
public override Task LoadUserOAuthProviderAsync(IAuthSession authSession, IAuthTokens tokens)
Returns​

System.Threading.Tasks.Task

Parameters​
TypeNameDescription
ServiceStack.Auth.IAuthSessionauthSession

The auth session.

| | ServiceStack.Auth.IAuthTokens | tokens | The OAuth tokens.

|

Inherited Methods​

AssertConsumerKey()​

View Source​
Declaration
protected virtual void AssertConsumerKey()

AssertConsumerSecret()​

View Source​
Declaration
protected virtual void AssertConsumerSecret()

AssertValidState()​

View Source​
Declaration
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​
Declaration
public abstract override Task<object> AuthenticateAsync(IServiceBase authService, IAuthSession session, Authenticate request, CancellationToken token = default(CancellationToken))
Returns​

System.Threading.Tasks.Task<System.Object>

Parameters​
TypeName
ServiceStack.IServiceBaseauthService
ServiceStack.Auth.IAuthSessionsession
ServiceStack.Authenticaterequest
System.Threading.CancellationTokentoken

Init(IServiceBase, ref IAuthSession, Authenticate)​

Sets the CallbackUrl and session.ReferrerUrl if not set and initializes the session tokens for this AuthProvider

View Source​
Declaration
protected IAuthTokens Init(IServiceBase authService, ref IAuthSession session, Authenticate request)
Returns​

ServiceStack.Auth.IAuthTokens

Parameters​
TypeName
ServiceStack.IServiceBaseauthService
ServiceStack.Auth.IAuthSessionsession
ServiceStack.Authenticaterequest

IsAuthorized(IAuthSession, IAuthTokens, Authenticate)​

View Source​
Declaration
public override bool IsAuthorized(IAuthSession session, IAuthTokens tokens, Authenticate request = null)
Returns​

System.Boolean

Parameters​
TypeName
ServiceStack.Auth.IAuthSessionsession
ServiceStack.Auth.IAuthTokenstokens
ServiceStack.Authenticaterequest

LoadUserOAuthProviderAsync(IAuthSession, IAuthTokens)​

View Source​
Declaration
public virtual Task LoadUserOAuthProviderAsync(IAuthSession userSession, IAuthTokens tokens)
Returns​

System.Threading.Tasks.Task

Parameters​
TypeName
ServiceStack.Auth.IAuthSessionuserSession
ServiceStack.Auth.IAuthTokenstokens

Implements​