Beispiel #1
0
 // Replace local IP with localhost if the server does not accept IP
 private static string AdjustRedirectUrl(string url, OAuthServerOptions serverOptions)
 {
     if (serverOptions.IsSet(OAuthServerOptions.TokenReplaceLocalIpWithLocalHost))
     {
         return(url.Replace("127.0.0.1", "localhost"));
     }
     else
     {
         return(url);
     }
 }
Beispiel #2
0
 public static IOAuthRemoteServer CreateOrUpdateServer(IEntitySession session,  string name, OAuthServerOptions options, 
     string siteUrl, string authorizationUrl, string tokenRequestUrl, string tokenRefreshUrl, string scopes,
     string documentationUrl, string basicProfileUrl, string profileUserIdTag)
 {
     IOAuthRemoteServer srv = session.EntitySet<IOAuthRemoteServer>().Where(s => s.Name == name).FirstOrDefault();
       if(srv == null)
     srv = session.NewEntity<IOAuthRemoteServer>();
       srv.Name = name;
       srv.Options = options;
       srv.SiteUrl = siteUrl;
       srv.AuthorizationUrl = authorizationUrl;
       srv.TokenRequestUrl = tokenRequestUrl;
       srv.TokenRefreshUrl = tokenRefreshUrl;
       srv.Scopes = scopes;
       srv.DocumentationUrl = documentationUrl;
       srv.BasicProfileUrl = basicProfileUrl;
       srv.ProfileUserIdTag = profileUserIdTag;
       return srv;
 }
Beispiel #3
0
        public static IOAuthRemoteServer NewOAuthRemoteServer(this IEntitySession session, string name,
                                                              OAuthServerOptions options, string siteUrl,
                                                              string authorizationUrl, string tokenRequestUrl, string tokenRefreshUrl,
                                                              string documentationUrl, string basicProfileUrl, string profileUserIdTag,
                                                              string tokenRevokeUrl = null)
        {
            var srv = session.NewEntity <IOAuthRemoteServer>();

            srv.Name             = name;
            srv.Options          = options;
            srv.SiteUrl          = siteUrl;
            srv.AuthorizationUrl = authorizationUrl;
            srv.TokenRequestUrl  = tokenRequestUrl;
            srv.TokenRefreshUrl  = tokenRefreshUrl;
            srv.DocumentationUrl = documentationUrl;
            srv.BasicProfileUrl  = basicProfileUrl;
            srv.ProfileUserIdTag = profileUserIdTag;
            srv.TokenRevokeUrl   = tokenRevokeUrl;
            return(srv);
        }
Beispiel #4
0
 public static bool IsSet(this OAuthServerOptions options, OAuthServerOptions option)
 {
     return((options & option) != 0);
 }
 public static bool IsSet(this OAuthServerOptions options, OAuthServerOptions option)
 {
     return (options & option) != 0;
 }
 public static IOAuthRemoteServer NewOAuthRemoteServer(this IEntitySession session, string name, 
     OAuthServerOptions options, string siteUrl,
     string authorizationUrl, string tokenRequestUrl, string tokenRefreshUrl,
     string documentationUrl, string basicProfileUrl, string profileUserIdTag)
 {
     var srv = session.NewEntity<IOAuthRemoteServer>();
       srv.Name = name;
       srv.Options = options;
       srv.SiteUrl = siteUrl;
       srv.AuthorizationUrl = authorizationUrl;
       srv.TokenRequestUrl = tokenRequestUrl;
       srv.TokenRefreshUrl = tokenRefreshUrl;
       srv.DocumentationUrl = documentationUrl;
       srv.BasicProfileUrl = basicProfileUrl;
       srv.ProfileUserIdTag = profileUserIdTag;
       return srv;
 }
Beispiel #7
0
        public static IOAuthRemoteServer CreateOrUpdateServer(IEntitySession session, string name, OAuthServerOptions options,
                                                              string siteUrl, string authorizationUrl, string tokenRequestUrl, string tokenRefreshUrl,
                                                              string tokenRevokeUrl,
                                                              string scopes, string documentationUrl, string basicProfileUrl, string profileUserIdTag)
        {
            IOAuthRemoteServer srv = session.EntitySet <IOAuthRemoteServer>().Where(s => s.Name == name).FirstOrDefault();

            if (srv == null)
            {
                srv = session.NewEntity <IOAuthRemoteServer>();
            }
            srv.Name             = name;
            srv.Options          = options;
            srv.SiteUrl          = siteUrl;
            srv.AuthorizationUrl = authorizationUrl;
            srv.TokenRequestUrl  = tokenRequestUrl;
            srv.TokenRefreshUrl  = tokenRefreshUrl;
            srv.TokenRevokeUrl   = tokenRevokeUrl;
            srv.Scopes           = scopes;
            srv.DocumentationUrl = documentationUrl;
            srv.BasicProfileUrl  = basicProfileUrl;
            srv.ProfileUserIdTag = profileUserIdTag;
            return(srv);
        }