Select to view content in your preferred language

Secure Services

740
2
06-18-2013 11:45 AM
JayKappy
Frequent Contributor
My services were just secured... I can create a token and place it in the application as such:
But that locks it down to the IP of the computer the Token was created on.

<esri:ArcGISDynamicMapServiceLayer ID="Streets" Visible="False" 
                                Token="aKZF72nfIe9_HBjlavn................4N0bg5nyGyWwFkjrlSElczFAG"                                                    
                                Url="https://test/arcgis/rest/services/MapleGrove/TestFeatureService/MapServer"
                                Initialized="Streets_Initialized"/>


How do I create allow for the user to input a User name and Password as in ArcGIS online to validate they are legit to view the data?  Do I create a table on the ArcGIS server that houses User Name and Password? 

How is this accomplished?

Thanks
0 Kudos
2 Replies
JohnGravois
Deactivated User
you'll need to use something like the IdentityManager.  have you seen this sample?
0 Kudos
JayKappy
Frequent Contributor
seems like a few lines of code....is this treated as something like a session variable? In the example I have to type in the user name and password every time I refresh the browser.

Minus the Class name in VB and the imports etc.... Seems like this is the only thing I need....

So does this pass user name credentials to EACH of the feature/map services that the application is consuming?
Is that how its working...I have about 15 layers in my application. I add these lines of code and I should be good to go?

Basically I Have about a Map Service with about 15 FC in it. It is now secured and cant be viewed unless the user accessing the data authenticates. I created a Token and that worked but want a User Name and Password. I want to use the passwords that are already set up (the ones I used to create the token). The User Names are the users setup in SDE database that give access to FC in SDE.

Does this Identify Manager pass the UserName and Password to the Service and perform the authentication to verify the person has access to view/edit the data?
What about multiple Layers in the project...the example only shows one Feature

Can I do this?

Text="{Binding ElementName=MyMap,Path=Layers[Layer1, Layer2, Layer3 etc].DisplayName}" />

        <Grid Name="LoggedInGrid"
              HorizontalAlignment="Right"
              VerticalAlignment="Top"
              Margin="0,15,15,0"
              Visibility="Collapsed">
            <Rectangle Stroke="Gray"
                       RadiusX="10"
                       RadiusY="10"
                       Fill="LightGray"
                       Margin="-10">
                <Rectangle.Effect>
                    <DropShadowEffect />
                </Rectangle.Effect>
            </Rectangle>
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition />
                    <ColumnDefinition />
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition />
                    <RowDefinition />
                    <RowDefinition />
                </Grid.RowDefinitions>
                <TextBlock Grid.Row="0"
                           Grid.ColumnSpan="2"
                           Text="{Binding ElementName=MyMap,Path=Layers[SaveTheBayMarineLayer].DisplayName}" />
                <TextBlock Text="Logged in as:"
                           Grid.Column="0"
                           Grid.Row="1"
                           Margin="2"
                           VerticalAlignment="Center" />
                <TextBlock Name="LoggedInUserTextBlock"
                           FontWeight="Bold"
                           HorizontalAlignment="Left"
                           Margin="2"
                           Grid.Column="1"
                           Grid.Row="1"
                           TextAlignment="Left" />
                <Button Name="ChangeUserButton"
                        Content="Sign Out"
                        Width="140"
                        Margin="0,5,0,5"
                        HorizontalAlignment="Center"
                        Grid.Row="2"
                        Grid.ColumnSpan="2"
                        Click="SignOut_Click" />
            </Grid>
        </Grid>


  Private Sub Challenge(ByVal url As String, ByVal callback As Action(Of IdentityManager.Credential, Exception), ByVal options As IdentityManager.GenerateTokenOptions)
    SignInDialog.DoSignIn(url, Sub(credential, err)
                                 If err Is Nothing Then
                                   ToolBorder.Visibility = System.Windows.Visibility.Visible
                                   LoggedInGrid.Visibility = System.Windows.Visibility.Visible
                                   LoggedInUserTextBlock.Text = credential.UserName
                                 End If
                                 callback(credential, err)
                               End Sub, options)
End Sub
0 Kudos